Keep Menu Template Style for a view when navigating from that view to a view template of its own

14 views
Skip to first unread message

Sam Clifton

unread,
Aug 10, 2016, 5:17:23 PM8/10/16
to Joomla! General Development
Hi there,

I'm creating a large component that manages a list of customers.

My situation.. I have a menu named Admin that uses a different site template than the default. When you navigate to one of the admin menu items, the admin theme is used.

However! In the situation where you are on the Customers list and click on a user to navigate to the customer layout from the Customers View, the default site template is used.

I would have thought that if you set a view as a menu item and said that it should use X template that it would be used throughout all of that views layouts also.. But apparently not. Am I doing something wrong? Do I have to add extra code to keep the template set by the menu item or what?


In the view/customers/default.php each customer link hrefs to "index.php?option=com_parcme&task=Customers.showCustomer"

The Customer.showCustomer() will then collect the data and redirect to the views customer template using "$this->setRedirect(JRoute::_('index.php?option=com_parcme&view=customers&layout=customer', false)"

The user is directed to the layout. But the default site template is used, instead of the one set by the menu. Any help would be greatly appreciated.

Kind Regards
Sam

Sam Clifton

unread,
Aug 11, 2016, 3:06:52 AM8/11/16
to Joomla! General Development
Not to worry! Found the solution, currently away from the computer so shall post it later for others to see

Sam Clifton

unread,
Aug 11, 2016, 4:42:58 AM8/11/16
to Joomla! General Development
Okay.. For those who have run into this super noob problem.. Simply use JRoute on the view/default.php for links as it automatically includes the ItemId into the URL which is the identifier for the menu item. Once this is included the theme from the menu sticks with the links you navigate too. 

Before:
window.location.href = "index.php?option=com_parcme&task=AdminDashboard.showUsersDetails&itemid="+jQuery(this).attr("id");
After
window.location.href = "<?php echo JRoute::_('index.php?option=com_parcme&view=customers&layout=customer', false); ?>&cid="+jQuery(this).attr("id");
Reply all
Reply to author
Forward
0 new messages