Module admin - redirect to home after action [solved]

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
turniphead
Forum Members
Forum Members
Posts: 40
Joined: Thu Jul 31, 2008 12:16 pm

Module admin - redirect to home after action [solved]

Post 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?
Last edited by turniphead on Tue Sep 02, 2008 2:09 pm, edited 1 time in total.
alby

Re: Module admin - redirect to home after action

Post 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
turniphead
Forum Members
Forum Members
Posts: 40
Joined: Thu Jul 31, 2008 12:16 pm

Re: Module admin - redirect to home after action

Post 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.
Post Reply

Return to “Developers Discussion”