I'm a newcomer to CMSMS and I am already a huge fan. I plan on using CMSMS for many projects in the future, and I hope I can help add to the community effort.
I'm developing a new module that handles basic "Store Locator" functions. Everything is working great, except I'm having an issue mapping clean URLs for my new module. Specifically, I seem to have everything working correctly, except that the wrong page template loads. For some reason, my Home Page template loads when displaying the "Store Detail" page, even though all the other pages use the Locations page as they should.
Here are some examples from the development site:
http://67.205.50.108/
This is the home page. Not terribly relevant, except that it is a unique template used only for the Home Page. Notice the row of boxes along the bottom.
http://67.205.50.108/locations
This is the Locations module "Main Page". It works perfectly and uses the Location template correctly.
http://67.205.50.108/index.php?mact=Locations,m4,detail,1&m4alias=denver&m4returnid=57
This is the Locations module "Detail Page", using the long URL. Again, works perfectly and uses the correct template. (Note: I edited the post to use a long URL that mirrors the clean URL functionality exactly...this example was different originally.)
http://67.205.50.108/locations/denver/
And...here's the issue. I can map the parameter I need (the "page alias") and it calls the correct action for the Locations module, grabs the correct data...but uses the Home Page template!?
I've tried some debugging, but to no avail. I've tried passing various parameters as defaults, I've checked variables during runtime to make sure the module name was passed correctly, etc. I can't figure out why it uses the Home Page template.
Here is the SetParameters function in place at the moment:
Code: Select all
function SetParameters()
{
$this->CreateParameter('locations', '', $this->lang('help_locations'));
$this->SetParameterType('alias', CLEAN_STRING);
$this->RegisterRoute('/[Ll]ocations\/(?P<alias>[a-zA-Z]+)$/',array('action'=>'detail'));
}
EDIT: I should also note that I've tried passing the "returnid" parameter of 57 as a default, and even as another parameter in the URL (just to see if it would work), but the script then performs the default action instead of the detail action, even though the action parameter is being set in the defaults array. I'm sure this is important, since the Locations page is id#57, but I'm not sure how to pass it correctly or what effect it has on this implementation.
Thanks!
(Edited as noted above)