0
回答
Drupal7中的template.php如何写分页的问题?
终于搞明白,存储TCO原来是这样算的>>>   

template文件:

if($variables['type'] == 'group'){
	$query = db_select ( 'node', 'n' )->extend('PagerDefault')->limit(2);
	$query->fields ( 'n' );
	$objects = $query->execute ()->fetchAll ();
	$rows = array ();
	foreach ( $objects as $key => $object ) {
		$row = array ();
		$row ['nid'] = $object->nid;
		$rows[] = $row;
	}
	$variables['group_list'] = $rows;
	$args = array('element' => 1,'quantity'=>10);
	$variables['group_pager'] = theme('pager',$args);
}
node--group.tpl.php文件

      <?php 
      foreach ($group_list as $value) {
      ?>
      <h3><?php echo $value['nid']?></h3>
       <?php 
                }
      ?>
      <?php echo  $group_pager?>
我参照了https://api.drupal.org/api/drupal/includes!pager.inc/function/theme_pager/7这里的提示来做。 但是没有显示分页的地方,请问哪里没写好呢?

请输入图片描述

PHP
举报
天南海北
发帖于4年前 0回/173阅
顶部