Joomla-cms: Alternative category layout does not work

Created on 21 Aug 2018  路  21Comments  路  Source: joomla/joomla-cms

Joomla 3.8.11

Alternative category layout from my template does not work.

小opy file blog.php from the location /components/com_content/views/category/tmpl/
to /templates/mytemplate/html/com_content/category/
So overriding works.
But:
If rename file, for example, myblog.php and choose this layout when edit category in back-end (options tab), overriding does not work.

J3 Issue No Code Attached Yet

Most helpful comment

Agree, this issue has been raised already so many times that we should not just close it but improve it. Otherwise we will have this discussion over and over again.

All 21 comments

Please ask help on the forums. This repository concerns in first Place Joomla-Core coding. For this Reason closing this Issue, thanks.

Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/21800

But the override is not a function of the Joomla-Core?
Overriding does not work.
Please take a closer look at this.

Set to "open" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/21800

Reopened as stated above.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/21800.

It looks like it is broken here too.
If it is confirmed, it is a major break.

To help solve the issue:
If we go into Articles Options, we do get the choice:

screen shot 2018-08-22 at 07 34 48

But in the category blog menu item we don't
screen shot 2018-08-22 at 07 36 32

@infograf768 this is expected behavior. See #21175 comments.

You are evidently right.
We have to create a custom xml in order to propose it as new menu item type.

screen shot 2018-08-22 at 08 02 30

The xml can be a copy of the core one EXCEPT its layout name

<layout title="COM_CONTENT_CATEGORY_VIEW_MY_BLOG_TITLE" option="COM_CONTENT_CATEGORY_VIEW_MY_BLOG_OPTION">
        <help key = "JHELP_MENUS_MENU_ITEM_ARTICLE_CATEGORY_BLOG" />
        <message>
            <![CDATA[COM_CONTENT_CATEGORY_VIEW_BLOG_DESC]]>
        </message>
    </layout>

In order to choose it (I did not create a string here)
screen shot 2018-08-22 at 08 15 45

Closing as explanations have been given in details...

But i don't want to override menu Item.
I want to override blog layout.
Joomla offers it in Category edit Options.
But it doesn't work.

@Gnevyshev
The possible layout override in category edit Options in the blog menu item ONLY concerns articles displayed by the blog NOT the blog itself.

If you want to always override the joomla blog layout, then just add in html the files concerned with the SAME name as in core and modify them to fit.
If you want the choice between 2 types of blog layout, create a menu item type as stated above.

This needs a simple User Interface.

@infograf768
Yes, I see that now it works that way. But it's not right. It would be better if we could set the layout for category.

@Gnevyshev the Layout option from category is used for categories that have no menu item. If your category has a menu item, it will use the layout from menu item.

BTW: the interface to create overrides in a template exists through The overrides tab
screen shot 2018-08-22 at 09 00 11

There one can copy/rename/edit/create the necessary files.

But i don't want to override menu Item.
I want to override blog layout.
Joomla offers it in Category edit Options.
But it doesn't work.

I think the language string description can have some improvement

The 'Layout' in category options

Is used when

  • no active menu item
  • there is an active menu item but it is not a category view menu item

About "Choose layout" in category menu item it is not so clear that it is about articles

I have not tested anything, i was only looking at source code, so i could be wrong

@SharkyKZ

the Layout option from category is used for categories that have no menu item. If your category has a menu item, it will use the layout from menu item.

Understand.

@ggppdk, agree.

Agree, this issue has been raised already so many times that we should not just close it but improve it. Otherwise we will have this discussion over and over again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brianteeman picture brianteeman  路  6Comments

joomleb picture joomleb  路  3Comments

brianteeman picture brianteeman  路  4Comments

Didldu-Florian picture Didldu-Florian  路  4Comments

aDaneInSpain picture aDaneInSpain  路  4Comments