Redirect() doesn't work in my module

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
matt

Redirect() doesn't work in my module

Post by matt »

All,

I'm having some problems using the Redirect() method in my module. After I call it I get the "404 Not Found" and the URL in the address bar is:
http://localhost/simple-0.10/moduleinte ... eturnid=38

Any idea how to solve this? I just want to redirect to action "addwine" in my module "Wine". The whole module is executed "inline".

--
Matt.
Last edited by Guest on Wed Aug 31, 2005 1:12 pm, edited 1 time in total.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: Redirect() doesn't work in my module

Post by Ted »

What is the URL of index.php, and can you paste in the Redirect() call you used?

Thanks.
matt

Re: Redirect() doesn't work in my module

Post by matt »

index.php is http://localhost/simple-0.10/index.php. This URL for instance works fine:

http://localhost/simple-0.10/index.php? ... 38&page=38

I called the method like this:

$this->Redirect($id, 'addwine', $return_id);

I checked that $id has the value of 'm1' and return_id in this particular case is '38'.

--
matt
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: Redirect() doesn't work in my module

Post by Ted »

Something doesn't seem right with the flow...  I wouldn't think you'd need to Redirect inline.

I'm assuming that this module displays a form.  The CreateFormStart should have an inline parameter.  When you set that to true, then submitting the form will work inline.

Does that make sense?
matt

Re: Redirect() doesn't work in my module

Post by matt »

I've separate actions for form display and submition. I wanted to redirect back to display (addwine) action when validating the form in the submit action fails. I can just as well call the same method as addwine action calls, but I just thought it would be cleaner to just redirect to the right action.

The addwine action does display a form and it already uses the inline parameter (set to true).

I did a quick test and it seems to work when I replace the '&' with just '&' in the URL. But of course it doesn't work inline then. It seems there's no way to call Redirect() in an inline way.

BTW: I think I'm missing the whole purpose of non-inline modules as well as the proper way of using them (everything just shows up twice when I don't use inline). Can you point me to any resource/forum post with some explanation of this solution?

--
Thanks,
matt
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: Redirect() doesn't work in my module

Post by Ted »

Well, the original module flow was something more along the lines of how Comments works.

You click the link at the bottom of the page.  The module takes over the whole {content} area for a particular amount of time.  Then redirects back to the page it originally took over from.

The inline stuff adds a degree of complexity...

However, I agree that Redirect should have an inline paramter.  I'll add it to my todo list.
Locked

Return to “CMSMS Core”