[SOLVED] A simple pretty url question

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
User avatar
FantomCircuit
Forum Members
Forum Members
Posts: 75
Joined: Fri Nov 10, 2006 1:34 am

[SOLVED] A simple pretty url question

Post 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 :)
Last edited by Anonymous on Wed Aug 01, 2007 12:33 am, edited 1 time in total.
User avatar
FantomCircuit
Forum Members
Forum Members
Posts: 75
Joined: Fri Nov 10, 2006 1:34 am

Re: A (Possibly) simple pretty url question

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

Return to “Developers Discussion”