Answer the question
In order to leave comments, you need to log in
How to inject ajaxLink inside CMenu widget?
Please tell me how to embed ajaxlink in the menu
<?php $this->widget('zii.widgets.CMenu',array(
'items'=>array(
array('label'=>'Home', 'url'=>array('/site/index')),
array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')),
array('label'=>'Contact', 'url'=>array('/site/contact')),
array('label'=>'Login', 'url'=>array('/site/login'), 'visible'=>Yii::app()->user->isGuest),
array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest) ),
)); ?>
CHtml::ajaxLink('Вход', $this->createUrl('user/login'),
array('update' => '#exampleModal'),
array('id'=>'login-btn','class'=>'btn btn-success btn-md','onclick' => '$("#exampleModal").arcticmodal();')
);
Answer the question
In order to leave comments, you need to log in
Try something like:
<?php $this->widget('zii.widgets.CMenu', array(
'items' => array(
...
array(
'label' => 'Вход',
'url' => array('/site/login'),
'visible' => Yii::app()->user->isGuest,
'linkOptions' => array(
'ajax' => array('update' => '#exampleModal'),
'id' => 'login-btn',
'onclick' => '$("#exampleModal").arcticmodal();',
),
),
...
),
)); ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question