J1.5 Component, different view but the same menu option?

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
User avatar
deepthoughts
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Tue Sep 27, 2005 1:12 pm
Location: The northern part of Sweden (Piteå)

J1.5 Component, different view but the same menu option?

Post by deepthoughts » Tue Mar 04, 2008 6:30 pm

I seem to be missing something very important when developing my components. For instance I've created a simple event-calendar and when logged in you have the possibility to add items to the calender by clicking a link. This link goes to the same component but with a different view passed (&view=edit). When visiting this link Joomla interprets this as leaving the calendar menu option. I don't know if this makes any sense so I'll try with an example.

I've got the menu option "Calendar" and when viewing it the calendar shows up nicely and "Calendar" is marked as the active menu option. In the calendar view there is an option for logged in users to add events and when clicking the link the form to add events is shown but the menu option "Calendar" is no longer marked as the active menu option, in fact there is no menu option marked as active.

What is the correct way to do this? I've noticed that there is function to set the active menu option ( setActive($id) ) but how do I fetch and pass the correct menu-id to the new view? Is that the way you're supposed to do it?
Stefan Nitsche
stefan_at_nitsche_dot_se

radiant_tech
Joomla! Apprentice
Joomla! Apprentice
Posts: 41
Joined: Sat Dec 15, 2007 3:02 pm
Location: Washington DC Metro

Re: J1.5 Component, different view but the same menu option?

Post by radiant_tech » Sat Mar 15, 2008 3:10 pm

Perhaps you are missing the hidden field with the component name on the page?

Code: Select all

<input type="hidden" name="option" value="com_yourcomponent" />
Denise


Post Reply