在Zend Framework 2导航中,如何在标签中呈现HTML内容? [英] In Zend Framework 2 navigation how can I render HTML content in label?
本文介绍了在Zend Framework 2导航中,如何在标签中呈现HTML内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Zend导航转义了我的标签内容.这是我的代码;
Zend navigation escapes my label content. Here is my code;
// config
'navigation' => array(
'default' => array(
array(
'label' => 'Home',
'route' => 'home',
),
array(
'label' => '<i class="fa fa-database"></i> Assets',
'route' => 'assets',
'pages' => array(
array(
'label' => 'Browse',
'route' => 'assets/default',
'controller' => 'index',
'action' => 'index',
),
array(
'label' => 'Detail',
'route' => 'assets/default',
'controller' => 'index',
'action' => 'host',
),
),
),
),
),
// in view script
<?php echo $this->navigation('navigation')->menu()
->setMinDepth(0)
->setMaxDepth(0)
->setUlClass('nav-side');?>
在此处有一个解决方案,但它不起作用.我怀疑它可能适用于Zend Framework 1.
There is a solution here, but it does not work. I suspect it is probably for Zend Framework 1.
推荐答案
有一个称为escapeLabels的方法.您可以将其设置为false.
There is a method called escapeLabels. You can set this to false.
<?php echo $this->navigation('navigation')->menu()
->setMinDepth(0)
->setMaxDepth(0)
->setUlClass('nav-side')
->escapeLabels(false);?>
我在手册中找不到此内容.如果有人可以在手册中找到(或添加)参考,请添加链接以帮助他人.
I could not find this in the manual. If anyone can find (or add) a reference in the manual please add a link to help others.
这篇关于在Zend Framework 2导航中,如何在标签中呈现HTML内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文