what determines the value of $id ?

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
Foden

what determines the value of $id ?

Post 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
Dee
Power Poster
Power Poster
Posts: 1197
Joined: Sun Mar 19, 2006 8:46 pm

Re: what determines the value of $id ?

Post 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
Post Reply

Return to “Developers Discussion”