dwolke / zf-bootstrap
ZF2 ViewHelper 用于 Bootstrap 3
dev-master
2015-05-12 21:09 UTC
Requires
- php: >=5.4
- zendframework/zendframework: >=2.3
This package is auto-updated.
Last update: 2024-09-17 10:56:55 UTC
README
这是一个简单的模块,用于与 ZF2 导航一起使用 Bootstrap 3 的 ViewHelper。
最初是为个人使用创建的,但请随意在自己的项目中使用它。
使用方法
在 module.config.php
中创建您的导航
'navigation' => array(
'default' => array(
array(
'label' => 'Startseite',
'route' => 'home',
),
//Dropdown-Menu
array(
'label' => 'Dropdown-Test',
'uri' => '#',
'dropdown' => true,
'pages' => array(
array(
'label' => 'Bar',
'route' => 'bar',
'controller' => 'Application\Controller\Index',
'action' => 'bar',
),
// Menu divider
array(
'type' => 'uri',
'divider' => true,
),
array(
'label' => 'Baz',
'route' => 'baz',
'controller' => 'Application\Controller\Index',
'action' => 'baz',
),
),
),
),
),
将导航添加到服务管理器
'service_manager' => array(
// this adds the default Navigation
'factories' => array(
'my_navigation' => 'Zend\Navigation\Service\DefaultNavigationFactory',
),
),
并在您的视图/布局脚本中使用视图助手
<?php
// render only the 'ul'
echo $this->navigation('my_navigation')->bsNavMenu()->setUlClass('nav navbar-nav');
// or render the whole Navbar
echo $this->navigation('my_navigation')->bsNavBar()->setOptions($navbarOptions);
?>
$navbaroptions
是一个包含以下选项的数组
inverse
: true | falsefluid
true | false (container-fluid | container)position
(string): fixed-top | fixed-bottom | static-topulClass
(string): 第一个 'ul' 的 css 类brandTitle
(string)brandLink
(string)brandImg
(string): 图片的路径brandShowTitle
: true | false
所有选项都是可选的 ;-)