Forums / Cotonti / Skins / Current class on ID problem

GHengeveld
#30203 2011-07-13 16:01

Do you have the JavaScript code on every page (including the edit page)?

I think you're missing a space before 'current' in your script (right now it seems you're appending 'current' to any existing class).

There are various ways to set a class on the active menu item. One way is to use JavaScript to match the current page URL to the URL of the menu item, which is what we do on Cotonti.com. We can safely do this because we use URL rewrites so we have no problems with lower-level pages such as an edit page. Look in the sourcecode for the setActiveTab function. Another way, which is neater but more complex, is to use CoTemplate to dynamically set a class. You can use variables such as {PHP.z} and {PHP.e} in combination with template logic or a callback function to match a menu item to the current page.

See also this topic.