Module Development - having trouble with $params
Posted: Thu Sep 04, 2014 7:47 pm
I'm developing a module and am having trouble retrieving parameters from the page URL. I'm using v1.11.11.
I'd like to have a parameter 'month' made available to the module, from the page parameter 'month':
http://example.com/index.php?page=test&month=1
I bought the CMS Made Simple Development Cookbook to help, and it seems that I need to prepend my parameter name with the $id variable present in my action. So if $id='m8b20b', the example would become:
http://example.com/index.php?page=test&m8b20bmonth=1
Whenever I output the $params variable in my action, all that is listed is 'module' and 'action'...
yields:
Inside of my module.php, here's what I have regarding parameters:
I've removed the above code to see if the parameter comes through. I'll then see the messages in the admin log about not properly cleaning input params, but I haven't managed to get the parameter to come through yet. I'm betting this is something really simple I'm missing...
Thanks!
Jon
I'd like to have a parameter 'month' made available to the module, from the page parameter 'month':
http://example.com/index.php?page=test&month=1
I bought the CMS Made Simple Development Cookbook to help, and it seems that I need to prepend my parameter name with the $id variable present in my action. So if $id='m8b20b', the example would become:
http://example.com/index.php?page=test&m8b20bmonth=1
Whenever I output the $params variable in my action, all that is listed is 'module' and 'action'...
Code: Select all
debug_display($params, 'Parameters');
Code: Select all
Debug display of 'Parameters':(0.128146) - (usage: 12802112) - (peak: 12939184)
Number of elements: 2
Array
(
[module] => CCBCalendar
[action] => monthList
)
Inside of my module.php, here's what I have regarding parameters:
Code: Select all
function InitializeFrontend() {
$this->RestrictUnknownParams();
$this->SetParameterType('month', CLEAN_INT);
}
function InitializeAdmin() {
$this->CreateParameter('month', -1, 'Month');
}
Thanks!
Jon