I'm trying to set up pretty urls for my module, but I didn't understand how pretty urls work in CMSMS. I have studied New's pretty urls and tried to replicate their behaviour, but without success.
Then, I've found this post ( http://forum.cmsmadesimple.org/index.php?topic=13934.msg68641 ) and my pretty urls began to works.
Now, I would have the ITEM_ID (and other variables) dynamically passed to the url, but I can't figure out how to do it.
The pretty url I would like to have is something like: http://www.mysite/mymodule_name/item_title.htm (with all the other parameters passed but not visible in the url)
in action.default.php I got:
$aliased_title = munge_string_to_url($row['Title']);
$prettyurl = 'Module/'.$aliased_title;
$par=array();
$par = array('ITEM_ID'=>$row['ITEM_ID'],'returnid'=>$returnid);
$onerow->Title = $this->CreateLink($id, 'detail_page', $returnid, $row['Title'], $par , '', false, false, '', true, $prettyurl);
in MyModule.module.php:
// In this way, pretty urls work, but I have static returnid and ITEM_ID...
// In this way, pretty urls DON'T work$this->RegisterRoute('/[mM]odule\/(?P[A-Za-z0-9-]+)$/',array('action'=>'detail_page','returnid'=>'23','ITEM_ID'=>'234'));
$this->RegisterRoute('/[mM]odule\/(?P[A-Za-z0-9-]+)$/',array('action'=>'detail_page','returnid'=>$returnid,'ITEM_ID'=>$params['ITEM_ID']));
Thank you
----------------------------------------------
Cms Version: 1.7.1
Installed Modules:
* CMSMailer: 2.0
* FileManager: 1.0.2
* MenuManager: 1.6.3
* ModuleManager: 1.3.3
* News: 2.10.5
* nuSOAP: 1.0.1
* Printing: 1.0.4
* Search: 1.6.3
* ThemeManager: 1.1.1
* TinyMCE: 2.7.0
* MyModule: 1.0
Config Information:
* php_memory_limit:
* process_whole_template: false
* max_upload_size: 2000000
* default_upload_permission: 664
* assume_mod_rewrite: true
* page_extension: .htm
* internal_pretty_urls: false
* use_hierarchy: true
Php Information:
* phpversion: 5.3.2-0.dotdeb.1
* md5_function: On (Vero)
* gd_version: 2
* tempnam_function: On (Vero)
* magic_quotes_runtime: Off (Falso)
* E_STRICT: 0
* E_DEPRECATED: 0
* memory_limit: 128M
* max_execution_time: 30
* safe_mode: Off (Falso)
* session_save_path: /tmp (1777)
* session_use_cookies: On (Vero)
Server Information:
* Server Api: apache2handler
* Server Db Type: MySQL (mysqli)
* Server Db Version: 5.1.44
----------------------------------------------