A
A
AlexSer2018-12-06 09:58:19
Yii
AlexSer, 2018-12-06 09:58:19

How can I make a popup on any url in yii2?

Hi all! Tell me how you can make a pop-up modal window on any url if the user logs in for the first time, so that he selects the settings, and this happened on any Url?
Registering a check for each action is not an option ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Bay, 2018-12-06
@AlexSer

Put in layout.

<?

if (Yii::$app->user->isGuest) {
    

$js = <<<JS
   
$('body').on('click','a',function(e){
e.preventDefault();
//стартуете модальное окно
});

JS;
$this->registerJs($js);
}
?>

But it won't secure opening in another window. (It will be necessary to hide the original href if the user is not logged in. But there may be problems with search engines)
And most likely it will also pop up on the menu buttons.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question