Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-03-06 12:30:30
- azw
- Member
- Registered: 2007-01-29
- Posts: 279
Question about purpose of $limit in txp_link.php at line 103
Hi, I’m writing a plugin that expands on the code in txp_link.php.
What is the $limit
on line 103 supposed to do?
On line 103 it’s defined but it doesn’t appear to be used anywhere: $limit = 500;
Then on line 137 it’s redefined: $limit = max($link_list_pageby, 15);
And it’s used on line 139: list($page, $offset, $numPages) = pager($total, $limit, $page);
Is it extraneous?
89 if ($search_method and $crit)
90 {
91 $crit_escaped = doSlash($crit);
92
93 $critsql = array(
94 'id' => "ID in ('" .join("','", do_list($crit_escaped)). "')",
95 'name' => "linkname like '%$crit_escaped%'",
96 'description' => "description like '%$crit_escaped%'",
97 'category' => "category like '%$crit_escaped%'"
98 );
99
100 if (array_key_exists($search_method, $critsql))
101 {
102 $criteria = $critsql[$search_method];
103 $limit = 500;
104 }
105
106 else
107 {
108 $search_method = '';
109 $crit = '';
110 }
111 }
112
113 else
114 {
115 $search_method = '';
116 $crit = '';
117 }
118
119 $total = getCount('txp_link', $criteria);
120
121 if ($total < 1)
122 {
123 if ($criteria != 1)
124 {
125 echo n.link_search_form($crit, $search_method).
126 n.graf(gTxt('no_results_found'), ' class="indicator"');
127 }
128
129 else
130 {
131 echo n.graf(gTxt('no_links_recorded'), ' class="indicator"');
132 }
133
134 return;
135 }
136
137 $limit = max($link_list_pageby, 15);
138
139 list($page, $offset, $numPages) = pager($total, $limit, $page);
140
Offline
#2 2009-03-07 08:10:58
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Question about purpose of $limit in txp_link.php at line 103
Determines how many links to display per page. I think the 500
bit is an artifact.
Offline
#3 2009-03-07 08:38:56
- azw
- Member
- Registered: 2007-01-29
- Posts: 279
Re: Question about purpose of $limit in txp_link.php at line 103
Yeah, maybe it was used for testing at one point.
Thanks, Mary.
Offline
Offline