Forums / Developer / Module, sending Node ID to template

Module, sending Node ID to template

Author Message

Håkan Bergman

Wednesday 19 May 2010 12:13:06 am

Hello,

I have made my own extension and is using this command to set node id in template:

$tpl->setVariable( 'node_id', $NodeID );

This works perfectly when I go to /extension?id=x. as I am using this to load a form I can't post to it directly, so I am fetching the variable by _GET command. But this works perfectly for any node id and is sent to template.

In my case however, the visitor clicks on a button called "Apply" and then a form loads through JS with colorbox. The form loads correctly and even though I specify the exact same extension path with ID, it won't pass it on to the template.

Should I send the variable in some other way to the template or do I need to call the variable that is being sent in some other way than just {$node_id} ?

Best regards,

Håkan Bergman

Håkan Bergman

Wednesday 19 May 2010 1:21:15 am

The site I dropped the extension at used /index.php?/ in the URL and confused the extension _GET variable. After removing and using /index.php/extension?id=x it worked again, so there was nothing wrong with the PHP code passing the template node_id.