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 a student (his 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 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 (student resume) don't display. Instead I have the message saying there is no article in this category.

For each child category when choosing default Blog or List layout, articles are correctly displayed.

Could you please help me finding what I have missed.

Tahnk you

bumped to the homepage by Community yesterday

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

Not 100% sure if I got you right because there are quite a few questions in one which I am not able to see what the relation is.

But if I got you right it could be just the following setting:

Menu > Your Item > Blog Layout > Include Subcategories 

Choose 'All' there.


Apart from that your override files should not be located in the Joomla! component folder itself. They should be based in your Templates HTML folder like this:

YOUR_TEMPLATE/html/com_content/category/test.xml
YOUR_TEMPLATE/html/com_content/category/test.php
YOUR_TEMPLATE/html/com_content/category/test_item.php
YOUR_TEMPLATE/html/com_content/category/test_link.php
YOUR_TEMPLATE/html/com_content/category/test_children.php

If this two things are not answering your questions, please specify what is working already and what not. Especially why you think you need an override for this at all is not really clear to me.

  • I would like to override category blog view because I would like to have a Bootstrap card display of articles on each child categories. – Simon D. Apr 16 at 18:10
  • Hello, thank you for your reply. Articles of child categories are displayed from category blog list (when you click an article title). Not from a menu. I would like to avoid creating a hidden menu for each article. I think my default category options are good because, when I go back to core Blog or List layout in each child category (Options tab), articles are displaying normally. I've followed your suggestion and tried with override files located in my template. Same result : I've got the message "Threre is noarticle in this category". – Simon D. Apr 17 at 8:05
  • Sorry If I was confuse while trying to explain the context of my problem. To be more precise I would like to know why my custom override doesn't display any article while it appears correctly in category layout list and while it is a perfect copy of the default Blog layout. Only the name was changed. – Simon D. Apr 17 at 8:09

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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