本文整理汇总了PHP中TbHtml::navbarBrandLink方法的典型用法代码示例。如果您正苦于以下问题:PHP TbHtml::navbarBrandLink方法的具体用法?PHP TbHtml::navbarBrandLink怎么用?PHP TbHtml::navbarBrandLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TbHtml
的用法示例。
在下文中一共展示了TbHtml::navbarBrandLink方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Runs the widget.
*/
public function run()
{
$brand = $this->brandLabel !== false ? TbHtml::navbarBrandLink($this->brandLabel, $this->brandUrl, $this->brandOptions) : '';
ob_start();
foreach ($this->items as $item) {
if (is_string($item)) {
echo $item;
} else {
$widgetClassName = TbArray::popValue('class', $item);
if ($widgetClassName !== null) {
$this->controller->widget($widgetClassName, $item);
}
}
}
$items = ob_get_clean();
ob_start();
if ($this->collapse !== false) {
TbHtml::addCssClass('navbar-collapse', $this->collapseOptions);
ob_start();
/* @var TbCollapse $collapseWidget */
$collapseWidget = $this->controller->widget('\\TbCollapse', array('toggle' => false, 'content' => $items, 'htmlOptions' => $this->collapseOptions));
$collapseContent = ob_get_clean();
echo TbHtml::tag('div', array('class' => 'navbar-header'), TbHtml::navbarCollapseLink('#' . $collapseWidget->getId()) . $brand);
echo $collapseContent;
} else {
echo TbHtml::tag('div', array('class' => 'navbar-header'), $brand);
echo $items;
}
$containerContent = ob_get_clean();
$containerOptions = TbArray::popValue('containerOptions', $this->htmlOptions, array());
TbHtml::addCssClass('navbar-container', $containerOptions);
// Change css [container] to [navbar-container]
ob_start();
echo TbHtml::openTag('div', $containerOptions);
echo $containerContent;
echo '</div>';
$content = ob_get_clean();
echo TbHtml::navbar($content, $this->htmlOptions);
}
示例2: run
/**
* Runs the widget.
*/
public function run()
{
$brand = $this->brandLabel !== false ? TbHtml::navbarBrandLink($this->brandLabel, $this->brandUrl, $this->brandOptions) : '';
ob_start();
foreach ($this->items as $item) {
if (is_string($item)) {
echo $item;
} else {
$widgetClassName = TbHtml::popOption('class', $item);
if ($widgetClassName !== null) {
$this->controller->widget($widgetClassName, $item);
}
}
}
$items = ob_get_clean();
ob_start();
if ($this->collapse !== false) {
$this->collapseOptions = TbHtml::addClassName('nav-collapse', $this->collapseOptions);
// todo: fix collapse, currently it cannot be clicked when within a navbar
ob_start();
/* @var TbCollapse $collapseWidget */
$collapseWidget = $this->controller->widget('bootstrap.widgets.TbCollapse', array('toggle' => false, 'content' => $items, 'htmlOptions' => $this->collapseOptions));
$collapseContent = ob_get_clean();
echo TbHtml::collapseIcon('#' . $collapseWidget->getId());
echo $brand . $collapseContent;
} else {
echo $brand . $items;
}
$containerContent = ob_get_clean();
$containerOptions = TbHtml::popOption('containerOptions', $this->htmlOptions, array());
$containerOptions = TbHtml::addClassName($this->fluid ? 'container-fluid' : 'container', $containerOptions);
ob_start();
echo TbHtml::openTag('div', $containerOptions);
echo $containerContent;
echo '</div>';
$content = ob_get_clean();
echo TbHtml::navbar($content, $this->htmlOptions);
}
示例3: testNavbarBrandLink
public function testNavbarBrandLink()
{
$I = $this->codeGuy;
$html = TbHtml::navbarBrandLink('Brand text', '#', array('class' => 'link'));
$a = $I->createNode($html, 'a.brand');
$I->seeNodeCssClass($a, 'link');
$I->seeNodeAttribute($a, 'href', '#');
$I->seeNodeText($a, 'Brand text');
}
示例4: run
/**
* Runs the widget.
*/
public function run()
{
$brand = $this->brandLabel !== false ? TbHtml::navbarBrandLink($this->brandLabel, $this->brandUrl, $this->brandOptions) : '';
ob_start();
foreach ($this->items as $item) {
if (is_string($item)) {
echo $item;
} else {
$widgetClassName = TbHtml::popOption('class', $item);
if ($widgetClassName !== null) {
$this->controller->widget($widgetClassName, $item);
}
}
}
$items = ob_get_clean();
ob_start();
echo CHtml::openTag('div', array('class' => $this->fluid ? 'container-fluid' : 'container'));
if ($this->collapse !== false) {
$collapseId = TbHtml::getNextId();
$this->collapseOptions = TbHtml::addClassName('nav-collapse', $this->collapseOptions);
echo TbHtml::collapseIcon('#' . $collapseId) . PHP_EOL;
echo $brand . PHP_EOL;
$this->controller->beginWidget('bootstrap.widgets.TbCollapse', array('id' => $collapseId, 'toggle' => false, 'htmlOptions' => $this->collapseOptions));
echo $items;
$this->controller->endWidget();
} else {
echo $brand . PHP_EOL;
echo $items . PHP_EOL;
}
echo '</div>';
$content = ob_get_clean();
echo TbHtml::navbar($content, $this->htmlOptions);
}
示例5: run
/**
* Runs the widget.
*/
public function run()
{
$brand = $this->brandLabel !== false ? TbHtml::navbarBrandLink($this->brandLabel, $this->brandUrl, $this->brandOptions) : '';
ob_start();
if (!Yii::app()->user->isGuest) {
$menus = $this->Menudata();
} else {
$menus[0] = array();
}
$menus[1] = array('class' => 'bootstrap.widgets.TbNav', 'htmlOptions' => array('class' => 'pull-right'), 'items' => array(array('label' => '网站前台', 'url' => Yii::app()->request->hostInfo . Yii::app()->baseUrl), array('label' => '站点配置', 'url' => array('/settings/index'), 'visible' => !Yii::app()->user->isGuest), array('label' => '登录', 'url' => array('/site/login'), 'visible' => Yii::app()->user->isGuest), array('label' => Yii::app()->user->name, 'url' => '#', 'items' => array(array('label' => '个人资料', 'icon' => 'user', 'url' => '#'), array('label' => '退出', 'icon' => 'off', 'url' => array('/site/logout'))), 'visible' => !Yii::app()->user->isGuest)));
$this->items = $menus;
foreach ($this->items as $item) {
if (is_string($item)) {
echo $item;
} else {
$widgetClassName = TbArray::popValue('class', $item);
if ($widgetClassName !== null) {
$this->controller->widget($widgetClassName, $item);
}
}
}
$items = ob_get_clean();
ob_start();
if ($this->collapse !== false) {
TbHtml::addCssClass('nav-collapse', $this->collapseOptions);
ob_start();
/* @var TbCollapse $collapseWidget */
$collapseWidget = $this->controller->widget('bootstrap.widgets.TbCollapse', array('toggle' => false, 'content' => $items, 'htmlOptions' => $this->collapseOptions));
$collapseContent = ob_get_clean();
echo TbHtml::navbarCollapseLink('#' . $collapseWidget->getId());
echo $brand . $collapseContent;
} else {
echo $brand . $items;
}
$containerContent = ob_get_clean();
$containerOptions = TbArray::popValue('containerOptions', $this->htmlOptions, array());
TbHtml::addCssClass($this->fluid ? 'container-fluid' : 'container', $containerOptions);
ob_start();
echo TbHtml::openTag('div', $containerOptions);
echo $containerContent;
echo '</div>';
$content = ob_get_clean();
echo TbHtml::navbar($content, $this->htmlOptions);
}