RegisterRoute troubles in module upgrade

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
Locked
markS
Forum Members
Forum Members
Posts: 56
Joined: Wed Aug 20, 2008 3:04 pm

RegisterRoute troubles in module upgrade

Post by markS »

Hello,

I'm trying to port a custom module from a 1.x version of cmsms to the latest 2.2.x version. Most things are fine but I'm having trouble with RegisterRoute as what worked before no longer appears to function in quite the same manner.

The SetParameters function has been split into InitializeFrontend and InitializeAdmin, thus:

Code: Select all

function InitializeFrontend() {
$this->RegisterRoute('/detail\/(?P<refMunged>[^\/]+)\/(?P<titleMunged>[^\/]+)$/i',array('returnid'=>$pageID,'action'=>'detail'));

$this->RegisterRoute('/search\/not-found$/i',array('returnid'=>$pageID,'action'=>'default','invalidRef'=>true));

$this->SetParameterType('refMunged',CLEAN_STRING);
$this->SetParameterType('titleMunged',CLEAN_STRING);
}

function InitializeAdmin() {
$this->CreateParameter('refMunged','');
$this->CreateParameter('titleMunged','');
}
Lazy loading is deactivated for now as I understand that requires static routes, am I right?

We are passing certain variables in the RegisterRoute function, such as the returnid as we've set them via a preference rather than have them in the url, I prefer it that way.

The sort of urls we are passing are like:

https://example.com/detail/zzxd_1235671239/badgers-are-us.html

The structure of the urls is unchanged between the versions and the regular expressions are the same too.

Can anyone suggest what I've omitted or where I should start looking for the issue? The error log is not giving me any information.

Thanks,

Mark.
Locked

Return to “Developers Discussion”