Page 1 of 1

Embedding your module output in a different page after a..

Posted: Sun Jan 05, 2014 11:31 am
by Purevdorj
Hello. I am reading the book CMS Made Simple Development Cookbook and tried one example from this book but it does not work. the $params['target'] is unknown. browser shows the error -

Warning: Parameter target is not known by module drinks dropped in C:\wamp\www\uptown\lib\misc.functions.php on line 1411

anyone can help me? I pasted the code of module here

Code: Select all

<?php
if (!isset($gCms)) exit;
$flavors = array('Sour'=>'sour', 'Bitter'=>'bitter',
'Sweet'=>'sweet', 'Salty'=>'salty', 'Umami'=>'umami');
if (isset($params['flavor']))
{
echo 'Yum ... '.array_search($params['flavor'],$flavors);
return;
}
$smarty->assign('form_start',
$this->CreateFormStart($id, 'default', $params['target']));
$smarty->assign('input_flavor',
$this->CreateInputRadioGroup($id, 'flavor', $flavors));
$smarty->assign('submit',
$this->CreateInputSubmit($id, 'submit', 'Submit'));
$smarty->assign('form_end', $this->CreateFormEnd());
echo $this->ProcessTemplate('form.tpl');
?>

Re: Embedding your module output in a different page after a

Posted: Sun Jan 05, 2014 2:54 pm
by chandra
Which CMSMS version do you are using?

Re: Embedding your module output in a different page after a

Posted: Tue Jan 07, 2014 2:47 pm
by Jos
You have to define the parameter in the file drinks.module.php like:

$this->SetParameterType('target',CLEAN_INT);

Check for example the News module: news.module.php where to put that line, and examples for other parameter types