Drupal 7,如何更改寻呼机限制?

时间:2012-02-06 13:55:41

标签: drupal drupal-7

我想更改Drupal 7中的寻呼机默认限制。 我做了一些研究,但没有成功。

我知道我必须在主题的template.php中进行,但不知道如何。

这是评论:http://api.drupal.org/api/drupal/includes--pager.inc/function/theme_pager/6#comment-693他们显示了改变寻呼机的方法,但是当我将其添加到我的template.php时,我收到了几个错误:

Notice: Undefined index: < in theme_pager_previous() (regel 489 van /home/vhosts/rolandkedde.nl/subdomains/webshop/httpdocs/includes/pager.inc).
Notice: Undefined index: n in theme_pager_next() (regel 528 van /home/vhosts/rolandkedde.nl/subdomains/webshop/httpdocs/includes/pager.inc).
Notice: Undefined index: n in theme_pager_next() (regel 528 van /home/vhosts/rolandkedde.nl/subdomains/webshop/httpdocs/includes/pager.inc).
Notice: Undefined index: n in theme_pager_next() (regel 529 van /home/vhosts/rolandkedde.nl/subdomains/webshop/httpdocs/includes/pager.inc).
Notice: Undefined index: n in theme_pager_next() (regel 531 van /home/vhosts/rolandkedde.nl/subdomains/webshop/httpdocs/includes/pager.inc).
Recoverable fatal error: Argument 1 passed to drupal_get_query_parameters() must be an array, string given, called in /home/vhosts/rolandkedde.nl/subdomains/webshop/httpdocs/sites/all/themes/tao/template.php on line 402 and defined in drupal_get_query_parameters() (regel 408 van /home/vhosts/rolandkedde.nl/subdomains/webshop/httpdocs/includes/common.inc).

我希望你们能告诉我如何解决这个问题。

PS。抱歉我的英语不好。

1 个答案:

答案 0 :(得分:1)

Drupal 7

似乎对于Drupal 7来说,更改限制的唯一方法是在查询中设置它。

例如:

// Select nid from published nodes with 20 pager limit 
$query = db_select('node', 'n')
    ->condition('status', 1)
    ->extend('PagerDefault')
        ->limit(20)
    ->fields('n', array('nid'));

$results = $query->execute();

Drupal 6

只需将默认的theme_pager()函数复制到template.php文件中,其名称为yourthemename_pager(),其中yourthemename是主题的名称,并更改$limit参数你想要的数字。

限制为20的示例:

// In your case theme's name is "tao"
function tao_pager($tags = array(), $limit = 20, $element = 0, $parameters = array(), $quantity = 9) {
    global $pager_page_array, $pager_total;
    // all code of function
    // ....
}