I've missed something with how category layout override is working

Everything to do with Joomla! 3.x templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Simon Delmotte
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Thu Sep 24, 2015 10:28 am

I've missed something with how category layout override is working

Postby Simon Delmotte » Tue Apr 17, 2018 8:20 am

I'm working on a students directory with the following structures:

Directory (parent category)
|_ 2017-2016 (child category)
|_ 2016-2015 (child category)
|_ 2015-2014 (child category)


In each child category there are articles about students (their resume).

I'm using a List All Categories menu type to display all child categories.
I could override the layout of this List All Categories view.

Now what I would like is to override the layout of the Category Blog view used by child categories without having to create a menu for each child category.

So I've duplicated:

com_content/views/category/tmpl/blog.xml
com_content/views/category/tmpl/blog.php
com_content/views/category/tmpl/blog_item.php
com_content/views/category/tmpl/blog_link.php
com_content/views/category/tmpl/blog_children.php

I've rename each new files to have the following:

com_content/views/category/tmpl/test.xml
com_content/views/category/tmpl/test.php
com_content/views/category/tmpl/test_item.php
com_content/views/category/tmpl/test_link.php
com_content/views/category/tmpl/test_children.php

And I've changed the test.xml (changing 'BLOG' string by 'TEST'):

<layout title="COM_CONTENT_CATEGORY_VIEW_TEST_TITLE" option="COM_CONTENT_CATEGORY_VIEW_TEST_OPTION">
<help key = "JHELP_MENUS_MENU_ITEM_ARTICLE_CATEGORY_BLOG" />
<message>
<![CDATA[COM_CONTENT_CATEGORY_VIEW_TEST_DESC]]>
</message>

In the test.xml file I've changed nothing else.

Then for each child category under Options tab I've chosen my new test layout.

In frontend, the articles of child categories (students resume) don't display.
Instead I have the message saying there is no article in this category.

When choosing default Jooma! Blog or List layout, articles are correctly displayed.

Could you please help me finding what I have missed.

Tahnk you

User avatar
toivo
Joomla! Exemplar
Joomla! Exemplar
Posts: 9104
Joined: Thu Feb 15, 2007 5:48 am
Location: Nottingham, UK
Contact:

Re: I've missed something with how category layout override is working

Postby toivo » Tue Apr 17, 2018 8:35 am

Did you copy the overrides to the html folder of your template?

The following tutorial explains the process and the other shows how you can use the Template Manager to create override files in the correct folder:
https://docs.joomla.org/How_to_override ... omla!_core
https://docs.joomla.org/J3.x:How_to_use ... _Overrides
Toivo Talikka, Global Moderator
my first programs were assembled and run in 16KB :)
http://archive.computerhistory.org/resources/text/GE/GE.GE-115SystemSoftware.1967.102646096.pdf#zoom=100

Simon Delmotte
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Thu Sep 24, 2015 10:28 am

Re: I've missed something with how category layout override is working

Postby Simon Delmotte » Tue Apr 17, 2018 9:26 am

Hi toivo,
Thank you for your reply.
Yes I've tried with my override files in components/com_content/views/category/tmpl and in /templates/my_template/html/com_content/category
I'm not sure but I don't think the location of my override files is the problem because my custom override is displayed in the select field of available layouts in category options tab.
Regards

User avatar
toivo
Joomla! Exemplar
Joomla! Exemplar
Posts: 9104
Joined: Thu Feb 15, 2007 5:48 am
Location: Nottingham, UK
Contact:

Re: I've missed something with how category layout override is working

Postby toivo » Wed Apr 18, 2018 6:39 am

Simon Delmotte wrote:I don't think the location of my override files is the problem
The correct location of the override files is crucial for the overrides to work, and it is best to use the Template Manager for creating overrides: https://docs.joomla.org/J3.x:How_to_use ... _Overrides

Custom or alternative layouts are slightly different: https://docs.joomla.org/Layout_Overrides_in_Joomla
Toivo Talikka, Global Moderator
my first programs were assembled and run in 16KB :)
http://archive.computerhistory.org/resources/text/GE/GE.GE-115SystemSoftware.1967.102646096.pdf#zoom=100

Simon Delmotte
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Thu Sep 24, 2015 10:28 am

Re: I've missed something with how category layout override is working

Postby Simon Delmotte » Wed Apr 18, 2018 9:08 am

Hi toivo,

Again as you can see in the picture attached, my override is correctly displayed in the Layout select form in Options tab of child categories.

Doesn't it mean that my override files are in the right location?

I would like to add that the files of my test layout are exact copy of the files of the default blog layout.
I've only renamed them.

If I don't choose either Blog or List layout the articles in each child categories don't display.

In my Joomla! install, it looks like I can not use a newly created layout (test.php in my case).
I can only use default ones or the override of the defualt ones (blog.php or list.php).

Regards
You do not have the required permissions to view the files attached to this post.


Return to “Templates for Joomla! 3.x”

Who is online

Users browsing this forum: No registered users and 3 guests