To have the content displayed by a custom category blog layout (mycustomarcategoryblog.php).
Always displayed by components/com_content/views/category/tmpl/blog.php
Joomla! 3.8.5
Labels |
Added:
?
|
Status | New | ⇒ | Discussion |
Category | ⇒ | com_content com_menus |
Well, then, that will require override admin's com_menu, no?
And that wouldn't be practical.
Well, then, that will require override admin's com_menu, no?
No. The menu configs are already aware of scanning in template override directories for these XML files.
Except it doesn't do that now. Like I mentioned in the initial issue report:
Under "Options" Tab, when user clicks on "Choose a Layout", instead of seeing the list of layout from /templates/{template_name}/html/com_content/category/ it pulls from
/templates/{template_name}/html/com_content/article/
Because that "Choose a Layout" option is defining the layout for child articles from that menu item.
This part of the system is a little weird. When you choose a menu item type (in this case the category blog), the menu item defines a view and layout to be used and this part of the workflow isn't easily changed. So if you want the menu item to use your custom category layout, you need a mycustomarcategoryblog.xml
file alongside your mycustomarcategoryblog.php
file to define the menu item's configuration (you can copy components/com_content/views/category/blog.xml
as the basis for this).
Okay, and that's at the template level, right?
Right. templates/{template_name}/html/com_content/category/mycustomarcategoryblog.xml
and Joomla will pick up your layout as a new menu item type.
Thanks. Just tried and it works. Except: I no longer able to have multiple layouts for Category Blog. I tried with multiple custom layouts, and Joomla! picks the last layout.
I strongly encourage to put back the feature that developer can add multiple layouts and content author can pick based on that.
It basically killed Joomla's feature of multiple layouts for Category Blog.
You can image a case where I am using Joomla to host multiple sites:
Both Site A & B uses the same template. This wouldn't work, as of now.
If it's not letting you choose between multiple layouts that's a bug.
So long as you have customlayout1.php
and customlayout1.xml
together, that layout can be used as a menu item. Same for customlayout2
, myotherlayout
, or any other name.
What you probably can't have is multiple menu items with the translated name of "Category Blog". Which is probably expected behavior based on how the data arrays are keyed (same as a database, you can't have multiple items with the same key). So you'd need to use a different name for them.
Okay, thanks. It's working.
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-02-08 14:21:00 |
Closed_By | ⇒ | nimsothea |
Ian sure there are many other reports (and fixes) for this on the tracker.
Basically the current situation is that if you just create the layout as you have done them it is only available in the component and not the menu item. To make it available to select in the menu then you need to add an XML definition