Skip to main content
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
I try to redirect from one page to another and I get a Php-Notice about a missing model parameter
[Notice] Undefined variable: model
Line 145 in /srv/htdocs/framework/control/Director.php
I tried to add something like
$model = new Page();
but then, it outputs a blank screen.
I know, this is a Notice and almost invisible on production but it keeps me in Dev-Mode from having a clean output.
Is there another way to redirect a user from A to B?
Thank you very much in advance.
Director::direct() lsnt used for browser redirections.
You want redirect on a controller object or response object
I think I found it.
I had in mind some SS 2.4 snippets
but this is now:
as long as I am in a Controller-Object.
Is that right?
What if you are not in a Controller object?
For example, I want to redirect after executing custom Gridfield row action?
Afaik you are always 'in a controller', meaning there's always a Controller active, based on a URL, making sure the work gets done...
You can find the current controller by using Controller::curr()