Page 1 of 1

[SOLVED] pass parameters to a module from http request

Posted: Sun Aug 29, 2010 3:41 pm
by kissack
I am writing a module that displays data from a table.

I looked at skeleton and module maker and have a module that i can embed on a content page ({cms_module module='mymod}) and this works fine.

Because this is an index page I want to be able to link to another row in the table with a parameter.  If I amend my content call to {cms_module module='mymod' page='22'} then I can use that parameter to show item 22.

what I really need is a means to pass a variable to that page (in place of '22') or to directly request a page fro the URL (ie http://192.168.0.198/dev/cms/index.php? ... od&page=22), but I cant see how to achive this.

can anyone point me into the right direction?

thanks

--
Allan

[SOLVED] pass parameters to a module from http request

Posted: Tue Aug 31, 2010 8:28 am
by kissack
Good job the bank holiday weekend wasnt too nice weather wise :-)
I spent a lot of tiem googling this and reading posts on this forum and smarty.net

The solution is to amend my content call to be:
{capture assign="var_value"}{$smarty.get.mypage}{/capture}
{cms_module module='mymod' myvar=$var_value}

URL is:
http://..../cms/index.php?page=mymod&mypage=22)

and the default action uses the variable:
if (isset($params['myvar']))
 {
    $sql = 'SELECT * FROM ...etc etc ...'. $params['myvar] . '\');';

--
Allan