Answer the question
In order to leave comments, you need to log in
How to make Html be processed in Yii2 and not displayed on the screen?
Hello. The problem is the following: there is a main menu of the site, it is generated approximately as follows:
NavBar::begin([
'brandLabel' => '',
'brandUrl' => '#',
'options' => [
'class' => 'navbar-default front-navbar',
],
]);
$label = 'test';
$menuItems = [
[
'label' => $label,
'url' => '#',
'linkOptions' => [
'value' => Url::to(['default/show-cities',]),
'title' => 'Выберите город',
'class' => 'showModalButton',
'id' => 'choice-city-link',
]
],
];
echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-left'],
'items' => $menuItems,
]);
NavBar::end();
?>
$label
(or in it) to interpose <span>
with the text. But the trouble is that the tag code is displayed on the page. Tried Html::encode()
, didn't help. This one turns out to be inside , perhaps because of this, although, as far as I know, you can put tags in.
Please tell me how can I solve this problem?
Thanks in advance to all who respond. <a>
<a>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question