?
avatar nimsothea
nimsothea
8 Feb 2018

Steps to reproduce the issue

  1. Add custom layouts:
  • templates/{template_name}/html/com_content/article/mycustomarticlelayout.php
  • templates/{template_name}/html/com_content/category/mycustomarcategoryblog.php
  1. Create a a new menu item.
  2. Select Article > Category Bloc
  3. Look for an option to select view layout. There's only one, under: "Options" tab.
  4. Click on "Choose a Layout", you will see a list of layout, but they are "Article" layout (i.e. mycustomarticlelayout). There is no option to select "mycustomarcategoryblog".
  5. Pick a layout from the list (i.e. mycustomarticlelayout)

Expected result

To have the content displayed by a custom category blog layout (mycustomarcategoryblog.php).

Actual result

Always displayed by components/com_content/views/category/tmpl/blog.php

System information (as much as possible)

Joomla! 3.8.5

Additional comments

  • As developer, I am be able to add my own custom view layout for Category Blog display in my template, but it's not showing up for the content author to pick from.
  • As content author, I should be able t pick a layout to display Category Blog the way I want to, but I am not able to.
avatar nimsothea nimsothea - open - 8 Feb 2018
avatar joomla-cms-bot joomla-cms-bot - change - 8 Feb 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 8 Feb 2018
avatar nimsothea nimsothea - change - 8 Feb 2018
The description was changed
avatar nimsothea nimsothea - edited - 8 Feb 2018
avatar brianteeman
brianteeman - comment - 8 Feb 2018

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

avatar franz-wohlkoenig franz-wohlkoenig - change - 8 Feb 2018
Status New Discussion
avatar franz-wohlkoenig franz-wohlkoenig - change - 8 Feb 2018
Category com_content com_menus
avatar nimsothea
nimsothea - comment - 8 Feb 2018

Well, then, that will require override admin's com_menu, no?
And that wouldn't be practical.

avatar mbabker
mbabker - comment - 8 Feb 2018

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.

avatar nimsothea
nimsothea - comment - 8 Feb 2018

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/

avatar mbabker
mbabker - comment - 8 Feb 2018

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).

avatar nimsothea
nimsothea - comment - 8 Feb 2018

Okay, and that's at the template level, right?

avatar mbabker
mbabker - comment - 8 Feb 2018

Right. templates/{template_name}/html/com_content/category/mycustomarcategoryblog.xml and Joomla will pick up your layout as a new menu item type.

avatar nimsothea
nimsothea - comment - 8 Feb 2018

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.

avatar nimsothea
nimsothea - comment - 8 Feb 2018

It basically killed Joomla's feature of multiple layouts for Category Blog.

avatar nimsothea
nimsothea - comment - 8 Feb 2018

You can image a case where I am using Joomla to host multiple sites:

  • Site A: I want my category blog layout to be "customlayout1"
  • Site B: I want my category blog layout to be "customlayout2"

Both Site A & B uses the same template. This wouldn't work, as of now.

avatar mbabker
mbabker - comment - 8 Feb 2018

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.

avatar nimsothea
nimsothea - comment - 8 Feb 2018

Okay, thanks. It's working.

avatar nimsothea nimsothea - change - 8 Feb 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-02-08 14:21:00
Closed_By nimsothea
avatar nimsothea nimsothea - close - 8 Feb 2018

Add a Comment

Login with GitHub to post a comment