php为现有的opencart模块添加分页

时间:2015-01-04 23:03:22

标签: php pagination

我想修改一下:

if ($setting['article_type']!='featured_article') {
    /*recent_article*/ 
    if ($setting['article_type']=='recent_article') {
    $data = array(
                'sort'  => 'p.date_added',
                'order' => 'DESC',
                'start' => 0,
                'limit' => $article_limit
            );

            $articles = $this->model_news_article->getArticles($data);    

添加一些分页。 我尝试使用工作分页从另一个模块添加代码,但似乎无法正常工作

$this->data['article_ajax_load'] = $this->getArticle($article_category_id,$page,$limit,$description_limit);

    $page = 1;      
    $data = array(
            'filter_article_category_id' => $setting['parent_id'], 
            'sort'               => 'p.date_added',
            'order'              => 'DESC',
            'start'              => ($page - 1) * $setting['limit'],
            'limit'              => $setting['limit']
        );
        $article_total = $this->model_news_article->getTotalArticles($data);        
        $pagination = new Pagination();
        $pagination->total = $article_total;
        $pagination->num_links = 3;
        $pagination->page =$page;
        $pagination->limit = $limit;
        $pagination->text = $this->language->get('text_pagination');
        $pagination->url = 'index.php?route=module/article_list/getlist&cpath='. $article_category_id .'&page={page}'.'&limit=' .$limit;
        $this->data['pagination'] = $pagination->render();     

有没有简单的方法为其添加分页?

0 个答案:

没有答案