Page 1 of 1

Module admin - redirect to home after action [solved]

Posted: Tue Sep 02, 2008 10:01 am
by turniphead
I'm still having fun writing my first module.

One thing I need to do a lot in the admin area is go back to the module's admin home after performing an action (say a record update), instead of having the code just echo "Record Updated" and then sit there. Currently I'm using a redirect something like:

Code: Select all

$header='Location: http://mysite.com/admin/moduleinterface.php?mact=mymodule,,defaultadmin,0&myparam='.$myparams['someparam'];
header($header);
I'm sure there's a more graceful way of doing it - can anybody point me in the right direction please?

Re: Module admin - redirect to home after action

Posted: Tue Sep 02, 2008 1:09 pm
by alby
turniphead wrote: One thing I need to do a lot in the admin area is go back to the module's admin home after performing an action (say a record update), instead of having the code just echo "Record Updated" and then sit there. Currently I'm using a redirect something like:
My advice is print a message (if you have a error?)

try with:
$params = array(...........);
$this->Redirect($id, 'defaultadmin', $returnid, $params);

Alby

Re: Module admin - redirect to home after action

Posted: Tue Sep 02, 2008 1:59 pm
by turniphead
Hi Alby.
My method was actually working. I just thought that it was inelegant, and was sure there was a member function to do it.

Your suggestion  "$this->Redirect($id, 'defaultadmin', $returnid, $params);" looks like what I was searching for.

I will check it out and set this to closed as soon as I test it.

Thank you.