Answer the question
In order to leave comments, you need to log in
YII2. How to form a transition to a page depending on which page the user is on?
I have a simple post in this form, when you can add a picture, change tags and categories:
This can also be done by clicking on UPDATE:
When you click on save tags, for example, there is a redirect to the main view page (view):
But I would like to implement : if the user was on the view page before he moved to adding an image/tag/category, then return him there. if on the update page, then there. How to do it?
Answer the question
In order to leave comments, you need to log in
Good evening.
Try like this:
return $this->redirect(Yii::$app->request->referrer);
Option 1. In actionView/actionUpdate, save "view"/"update" + id to the session. When redirecting, take from the session.
Option 2. Add a new backAction + backId parameter to the "add"/"install" links and their form.action. When redirecting, take from get.
Option 3. The most cardinal is SPA (single page application). Change everything to ajax. There will be no redirects and page transitions at all.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question