[support] Using Drupal Pager in D5 Module

Fred Jones fredthejonester at gmail.com
Thu Aug 7 10:13:34 UTC 2008


>  '#type' => 'markup', // Don't forget this line, else you wont have your pager displayed :)

No, actually that is optional, as that is the default type. This code
for example:

		$form[] = array(
			'#value' => '<fieldset><legend>Search Results</legend>'
		);

works fine.

But I don't see how your code is different than mine. I have:

		$form[] = array(
			'#value' => mymodule_run_search()
		);
		$form['pager'] = array(
			'#value' => theme('pager', NULL, 10, 0)
		);

which displays first the search results and then the pager (or I want
it to). And in mymodule_run_search I have this:

	$sql = "SELECT nid, title, teaser FROM {node_revisions} WHERE body
like '%%%s%' ".
 			'group by nid order by nid';
	$r = pager_query($sql, 10,0,null,$_GET['title_text']);

and then some code to format the results. The search results part
works great--the only thing NOT working is the pager.

Thanks.


More information about the support mailing list