Php Yii助推器在文本上而不是按钮上弹出
Yii booster演示了如何在按钮上制作一个爆米花。我想在锚元素而不是按钮上创建一个。基本上,我想把流行音乐和易的结合起来。有人知道怎么做吗 这是弹出窗口的代码:Php Yii助推器在文本上而不是按钮上弹出,php,twitter-bootstrap,yii,yii-extensions,Php,Twitter Bootstrap,Yii,Yii Extensions,Yii booster演示了如何在按钮上制作一个爆米花。我想在锚元素而不是按钮上创建一个。基本上,我想把流行音乐和易的结合起来。有人知道怎么做吗 这是弹出窗口的代码: $this->widget( 'bootstrap.widgets.TbButton', array( 'label' => 'Top popover', 'type' => 'primary', 'htmlOptions' => array( 'data-title
$this->widget(
'bootstrap.widgets.TbButton',
array(
'label' => 'Top popover',
'type' => 'primary',
'htmlOptions' => array(
'data-title' => 'A Title',
'data-placement' => 'top',
'data-content' => "And here's some amazing content. It's very engaging. right?",
'data-toggle' => 'popover'
),
));
如果有一种方法可以改变这一点,不渲染按钮,而只是一个锚,那么问题就会解决,但我在代码中找不到任何可以用来实现这一点的东西
更新
按照Sergey的回答,以下是我所说的:
echo CHtml::Link("$detail->text", null,
array(
'rel' => 'popover',
'data-trigger' => "hover",
'data-title' => "$header",
'data-content' => "$body"
));
这接近于我所需要的,但由于某些原因,hove不起作用,仅显示单击和内容获取,而不是标题。您可以使用CHtml:
<?php echo CHtml::Link('<i class="icon-info-sign"></i>', null, [
'rel' => 'popover',
'data-trigger' => 'hover',
'data-title' => 'Your title',
'data-content' => 'Your content',
])?>
这很接近我所需要的,但我不能像你一样让它正常工作。我会把我在上面写的东西贴出来,以防万一我写错了什么。嗨,谢尔盖,你知道我的代码为什么不起作用吗?我只做了一些小的调整,这是完全必要的,因为我的PHP版本不接受数组的方括号。非常感谢您的帮助。更新了Bootstrap 2.3.2I的帖子,将其升级到Yii Booster的最新版本,但现在它抛出了错误“CClientScript及其行为没有名为“registerClientScript”的方法或闭包。它像以前一样提供了一个popover,但仍然没有标题,悬停时它仍然不会触发,只在单击时触发。
<?php Yii::app()->clientScript->registerScript("", "$('.ipopover').popover();", CClientScript::POS_READY) ?>
<?php echo CHtml::Link('<i class="icon-info-sign"></i>', null, array(
'class' => 'ipopover',
'data-trigger' => 'hover',
'data-title' => 'Your title',
'data-content' => 'Your content',
))?>