Page 1 of 1

[SOLVED] A simple pretty url question

Posted: Tue Jul 31, 2007 12:21 pm
by FantomCircuit
I am currently building a module, and am trying to get some pretty urls using registerroutes working how i want them. At the moment, if I define a route in Shop.module.php like so:

Code: Select all


$this->RegisterRoute('/[sS]hop\/product\/(?P<productalias>[A-Za-z0-9-]+)$/',array('action'=>'default'));

it calls the default action inside my shop module (which is how it should happen - no problems so far)

but, the content that my default action spits out gets put into the refering static page (either that or the home page if i type the address in directly)

i tried overriding it by putting page=>shop in the default params aray in my regiterRoute function like so:

Code: Select all


$this->RegisterRoute('/[sS]hop\/product\/(?P<productalias>[A-Za-z0-9-]+)$/',array('action'=>'default','page'=>'shop'));

But that didn't work.

I assume there is something I am missing here. Please Help! Thanks guys :)

Re: A (Possibly) simple pretty url question

Posted: Wed Aug 01, 2007 12:32 am
by FantomCircuit
Solved!
Please excuse my ignorance. :) The returnid param must be passed in the values array. Unfortunatley, I have not seen this mentioned in any documentation or anything. So it should look like this:

Code: Select all

$this->RegisterRoute('/[sS]hop\/product\/(?P<productalias>[A-Za-z0-9-]+)$/',array('action'=>'default','returnid'=>'44'));
Where 44 is the id of the page you want everything to appear in.