Page 1 of 1

what determines the value of $id ?

Posted: Sat Dec 06, 2008 9:45 am
by Foden
I'm trying to digg into a problem with my site, where the calendar module have some problems "problems" with the value in $id (which is used in f.ex. CreateLink())

The error occurs when I have a calendar on my front page, this is assigned a value of m4, When the user selects a date, they are redirected to another page (I have set detailpage to another page). On this other page, the calendar module expects the $id value in the links to be m3, instead of m4, and the m4 is actualy assigned to the menu manager, which then barfs a bunch of errors at the site user, because it doesn't support the extra parameters.

Right now I have hardcoded the $id to be m3 inside the module, but this is not an optimal solution, as the $id parameter changes from time to time.

I have searched through the documentation, but I can't find any places that describe the mechanism behind the $id value, so I hope that someone could shed some light on it here..

Regards
Thomas

Re: what determines the value of $id ?

Posted: Sat Dec 06, 2008 10:12 am
by Dee
Each module call gets this/an ID assigned at execution (assigned in function cms_module_plugin in lib/module.functions.php).
This means that if you call a module 2 times on a page, each instance will get a different ID.
The module should keep track of this ID and use it where and as needed.

You say the calendar module expects the $id value in the links to be m3, instead of m4 on a page.
What module calls are you using in your templates? It's hard to tell what's going on without being able to replicate this.

Regards,
D