mwillbanks / zfc-twitter-bootstrap
此包已被弃用且不再维护。未建议替代包。
关于此包最新版本(0.3.0)没有可用的许可信息。
一个帮助实现ZFC Twitter Bootstrap的模块
0.3.0
2013-03-28 15:42 UTC
Requires
- php: >=5.3.3
- zendframework/zendframework: 2.*
This package is not auto-updated.
Last update: 2020-02-07 15:09:05 UTC
README
版本 0.2.1 由Mike Willbanks创建
命名
此模块目前命名为ZfcTwitterBootstrap,因为目标是将其纳入ZF-Commons区域。一旦这个模块达到功能完善的状态,它将被提交给ZF-Commons进行投票。如果模块未能通过,它将被重命名。
简介
ZfcTwitterBootstrap是一个模块,旨在处理ZFC2中Twitter Bootstrap的集成。开箱即用,它包括用于渲染表单、警告、徽章和标签的视图助手。总体而言,这个模块将继续增长,以生成Twitter Bootstrap包含的许多项目。
要求
- Zend Framework 2 (2.*)
安装
您的composer.json应包含以下内容
{
"require": {
"mwillbanks/zfc-twitter-bootstrap": "@dev"
}
}
在您的application.config.php
文件中启用模块
<?php
return array(
'modules' => array(
// ...
'ZfcTwitterBootstrap',
),
// ...
);
功能
- 表单集成
- 表单渲染器
- 表单元素
- 表单描述
- 导航集成
- 面包屑
- 菜单
- 视图助手
- 警告
- 徽章
- 关闭图标
- Flash消息
- 图标
- 图片
- 标签
- 井状容器
路线图
- Zend\Form - 已完成基本集成
- 警告消息 - 已完成基本视图助手
- 关闭图标 - 已完成基本视图助手
- 徽章 - 已完成基本视图助手
- Flash消息 - 已完成基本视图助手
- 图标 - 已完成基本视图助手
- 图片 - 已完成基本视图助手
- 标签 - 已完成基本视图助手
- 井状容器 - 已完成基本视图助手
- Zend\Navigation - 已完成基本集成
表单使用
<?php
// render a whole form
echo $this->ztbForm($this->form);
?>
<?php
// render element by element
$form = $this->form;
$form->prepare();
echo $this->form()->openTag($form);
echo $this->ztbFormElement($this->form->get('element'));
echo $this->form()->closeTag();
?>
警告使用
<?php
echo $this->ztbAlert('This is an alert');
// additional parameters: block level and class
echo $this->ztbAlert('This is an alert', true, 'warning');
// explicit usage
// explicit types: info, error, success, warning
echo $this->ztbAlert()->warning('This is an alert');
// explicit additional parameters: block level
echo $this->ztbAlert()->warning('This is an alert');
?>
徽章使用
<?php
echo $this->ztbBadge('This is a badge');
// additional parameters: class
echo $this->ztbBadge('This is a badge', 'info');
// explicit usage
// explicit types: info, important, inverse, success, warning
echo $this->ztbBadge()->info('This is a badge');
?>
关闭图标使用
<?php
echo $this->ztbCloseIcon();
// or render an anchor
echo $this->ztbCloseIcon('a');
?>
Flash消息使用
<?php
// controller/action
// other types Info, Success, Error
$this->flashMessenger()->addMessage(
'User could not be saved due to a database error.'
);
// other options
$this->flashMessenger()->addMessage(array(
'message' => 'User could not be saved due to a database error.',
'title' => 'Fatal Error!',
'titleTag' => 'h4',
'isBlock' => true,
);
?>
<?php
// view script
// render all messages in all namespaces
echo $this->ztbFlashMessenger()->render();
// explicit usage
// explicit types: default, info, success, error
echo $this->ztbFlashMessenger('error');
// or
echo $this->ztbFlashMessenger()->render('info');
?>
图标使用
<?php
echo $this->ztbIcon('user');
// additional parameters: color
echo $this->ztbIcon('user', 'white');
// explicit usage
echo $this->ztbIcon()->user();
echo $this->ztbIcon()->user('white');
// icon names with dashes should be camel cased when using this method
echo $this->ztbIcon()->plusSign();
?>
有关可用的图标,请参阅Twitter Bootstrap 图标
图片使用
<?php
echo $this->ztbImage('/path/to/img/img.png', 'circle');
// explicit usage
// explicit types: circle, rounded, polaroid
echo $this->ztbImage()->polaroid('/path/to/img/img.png');
?>
标签使用
<?php
echo $this->ztbLabel('This is a label');
// additional parameters: class
echo $this->ztbLabel('This is a label', 'info');
// explicit usage
// explicit types: info, important, inverse, success, warning
echo $this->ztbLabel()->info('This is a label');
?>
导航使用
<?php
echo $this->ztbnavigation()->ztbmenu($navContainer);
echo $this->ztbnavigation()->ztbbreadcrumbs($navContainer);
井使用
<?php
echo $this->ztbWell('This is a well');
// additional parameters: class
echo $this->ztbWell('This is a large well', 'well-large');
// explicit usage
// explicit types: small, large
echo $this->ztbWell()->small('This is a small well');
?>