Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/263.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 调用分页控件帮助程序时,如何使用参数设置路由?_Php_Routing_Pagination_Zend Framework2 - Fatal编程技术网

Php 调用分页控件帮助程序时,如何使用参数设置路由?

Php 调用分页控件帮助程序时,如何使用参数设置路由?,php,routing,pagination,zend-framework2,Php,Routing,Pagination,Zend Framework2,我正在尝试在新闻页和具有指定类别的新闻页上添加分页控件 对于简单新闻提要和具有指定新闻的新闻提要(news和news/category),我有两种不同的路径和操作。我想在页面中添加分页控件。我发现,我需要这样做(在简单的新闻提要中,它是有效的): 你的方法似乎是正确的。你能将新闻/类别路由配置添加到问题中吗?@foozy我用路由配置更新了我的问题。 <?=$this->paginationControl( $this->news, 'Sliding',

我正在尝试在新闻页和具有指定类别的新闻页上添加分页控件

对于简单新闻提要和具有指定新闻的新闻提要(
news
news/category
),我有两种不同的路径和操作。我想在页面中添加分页控件。我发现,我需要这样做(在简单的新闻提要中,它是有效的):


你的方法似乎是正确的。你能将新闻/类别路由配置添加到问题中吗?@foozy我用路由配置更新了我的问题。
<?=$this->paginationControl(
    $this->news,
    'Sliding',
    'pagination_control',
    array('route' => 'news/pagination')
)?>  
<?=$this->paginationControl(
    $this->news,
    'Sliding',
    'pagination_control',
    array('route' => 'news/category/pagination', array('category' => $this->category->getUrl()))
)?>
'news' => array(                                              
    'type' => 'Segment',                                      
    'options' => array(                                       
        'route' => '/news',                                   
        'defaults' => array(                                  
            'controller' => 'News\Controller\Item',           
            'action'     => 'index',                          
        ),                                                    
    ),                                                        
    'may_terminate' => true,                                  
    'child_routes' => array(                                  
        // other news child routes,                                                
        'category' => array(                                  
            'type' => 'Segment',                              
            'options' => array(                               
                'route' => '/:category',                      
                'constraints' => array(                       
                    'category'     => '[a-z]+',               
                ),                                            
                'defaults' => array(                          
                    'controller' => 'News\Controller\Item',   
                    'action'     => 'category',               
                )                                             
            ),                                                
            'may_terminate' => true,                          
            'child_routes' => array(                          
                'pagination' => array(                        
                    'type' => 'Segment',                      
                    'options' => array(                       
                        'route' => '/page-:page',             
                        'constraints' => array(               
                            'page'     => '[1-9][0-9]*',      
                        ),                                    
                        'defaults' => array(                  
                            'page'      => 1,                 
                        )                                     
                    ),                                        
                    'may_terminate' => true,                  
                ),                                            
            ),                                                
        ),                                                    
    ),                                                        
),