0
我阅读官方文档,但我不知道如何创建面包屑。这是我在module.config:面包屑。 ZF2
'gallery' => array(
'type' => 'Segment',
'options' => array(
'route' => '/gallery[/:id]',
'constraints' => array(
'id' => '[0-9]+',
),
'defaults' => array(
'__NAMESPACE__' => 'Home\Controller',
'controller' => 'Gallery',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'item' => array(
'type' => 'Segment',
'options' => array(
'route' => '/item[/:id]',
'constraints' => array(
'id' => '[0-9]+',
),
'defaults' => array(
'__NAMESPACE__' => 'Home\Controller',
'controller' => 'Gallery',
'action' => 'item',
),
),
),
),
),
'navigation' => array(
'default' => array(
array(
'label' => 'Gallery',
'route' => 'gallery',
'pages' => array(
array(
'label' => 'Gallery1',
'route' => 'gallery/1/item/',
'action' => 'index',
),
array(
'label' => 'Web',
'route' => 'gallery/2/item/',
'action' => 'index',
),
),
),
),
),
这item.php:
$this->navigation('navigation')
->breadcrumbs()
->setMinDepth(0)
->setPartial('partial/breadcrumb.phtml');
而这breadcrumb.phtml:
<ul class="breadcrumb">
<?php
foreach ($this->pages as $key => $page):
?>
<li>
<?php
if ($key < count($this->pages) - 1):
?>
<a href="<?php echo $page->getHref(); ?>"><?php echo $page->getLabel(); ?></a>
<?php
else:
?>
<?php echo $page->getLabel(); ?>
<?php endif; ?>
</li>
<?php endforeach; ?>
这不是加工。有谁知道如何解决它?
''route'=>'gallery/item''必须是路由名称不是路由路径 – newage