当url具有id时,Zf2不会正确加载布局

时间:2014-06-03 12:26:50

标签: php zend-framework zend-framework2 zend-form zfcuser

我的控制器是

  public function loadprojectAction()
{
    $this->layout ( 'layout/layoutin' );
    $id = (int) $this->params()->fromRoute('id', 0);
    echo $id;
    if (!$id) {
        return $this->redirect()->toRoute('album', array(
                'action' => 'add'
        ));
    }
    //$album = $this->getAlbumTable()->getAlbum($id);
    // This shows the :controller and :action parameters in default route
    // are working when you browse to /project/project/foo
    return array();
}

我的路线是。

          'routes' => array (
                    'project' => array (
                            'type' => 'segment',
                            'options' => array (
                                    'route' => '/project[/:action][/:id]',
                                    'constraints' => array (
                                            'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                                            'id' => '[0-9]+'

                                    ),
                                    'defaults' => array (
                                            'controller' => 'Project\Controller\Project',
                                            'action' => 'index' 
                                    ) 
                            ),
                    ) 
            )

布局不会显示图像和任何其他东西只有布局的主体。但它会加载图像标题。

0 个答案:

没有答案