[SOLVED] pass parameters to a module from http request

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
kissack
Forum Members
Forum Members
Posts: 18
Joined: Mon Oct 22, 2007 6:10 pm

[SOLVED] pass parameters to a module from http request

Post 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
Last edited by kissack on Tue Aug 31, 2010 8:29 am, edited 1 time in total.
kissack
Forum Members
Forum Members
Posts: 18
Joined: Mon Oct 22, 2007 6:10 pm

[SOLVED] pass parameters to a module from http request

Post 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
Last edited by kissack on Tue Aug 31, 2010 8:30 am, edited 1 time in total.
Post Reply

Return to “Modules/Add-Ons”