3

I need to be able to specify different layouts of the same View by way of the Menu item, resulting in a url having &layout=blahblah appended. - NOT using a template override.

i.e.: index.php?option=com_things&view=things&layout=tabs

This question has the code and structure I'm using, and her own answer solves the problem of the url, but how does one get the choice of layouts to appear when the menu item is being created.

This documentation appears to be referring to it, but where does this field belong to get a list of the available layouts when creating the menu item?

Update: This is the actual file structure - where/how to get "default" or "tabs" to appear as a choice when creating a menu item. The alternative layout works if I manually type &layout=tabs into the browser, so how does one get it included in the link that Joomla generates from the menu item?

enter image description here

0

Currently, different layouts are considered to be different menu item types. To make your alternative layout listed as menu item type, create a tabs.xml metadata file alongside tabs.php.

  • I've done exacty that. I actually have 3 different views, each with default.php and default.xml. One of them has tabs.xml and tabs.php, but it doesn't appear as a choice when creating a "Menu Item Type" while adding a menu, so I'm trying to figure out how to add it as a choice one that view has been selected. – GDP Jul 16 at 14:42
0

Did you put the metadata in properly?

I'm a bit confused. A really good example of connecting a layout to a menu item type is the first 8 lines of com_content's category blog XML file. In a nutshell, what you're needing in that file is a layout node. A barebones one:

<layout title="titleOfMenuItemType" option="nameOfLayout">
  <message><![CDATA[Description of Menu Item Type]]></message>
<layout>

Roam through the components, there are plenty of working examples there to look through.

But it sounds almost like what you're wanting to do is make the user first select a menu item type that points to a view, and after that make the user perform a second operation to select the layout, instead of doing both in one operation. If that's really what you're after, I'm curious as to what can be gained by doing that? Maybe I'm missing something.

Maybe if you'd explain what the problem is that this two-step approach is supposed to solve, we could do a better job of getting you to a solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.