Custom Blog files not rendering when using module categories Topic is solved

This forum is for general questions about extensions for Joomla! 4.x.

Moderators: pe7er, 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.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
ThorHammer
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Thu Aug 25, 2016 11:28 am

Custom Blog files not rendering when using module categories

Post by ThorHammer » Mon Apr 08, 2024 10:21 pm

Good day everyone,

I have made a copy of Articles Blog, renamed files and edited XML file and all is working
Files location: templates/MyTemplate/HTML/com_content/category/my-files

I have set up a menu item and have my custom Blog showing on the page
On the same page I have a categories module to filter items

My problem comes when I click a category, and display the items.
Instead of categories using the modified override files, I see it using blog.php from components, so my modifications are not rendered and the modified blog files are not used in this instance.

How do I make categories module use my modified Articles Blog override files instead of using default Article Blog files?

Thank you for any help here, this behaviour has got me!

PS, loving the new Joomla 4

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17467
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: Custom Blog files not rendering when using module categories

Post by toivo » Tue Apr 09, 2024 1:47 am

The name of the override folder is html, not HTML.
Toivo Talikka, Global Moderator

User avatar
AMurray
Joomla! Exemplar
Joomla! Exemplar
Posts: 9787
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: Custom Blog files not rendering when using module categories

Post by AMurray » Tue Apr 09, 2024 9:59 am

To clarify, toivo means *lowercase* html, not uppercase HTML (particularly relevant to Linux-based servers.
Regards - A Murray
General Support Moderator

ThorHammer
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Thu Aug 25, 2016 11:28 am

Re: Custom Blog files not rendering when using module categories

Post by ThorHammer » Tue Apr 09, 2024 11:30 am

toivo wrote:
Tue Apr 09, 2024 1:47 am
The name of the override folder is html, not HTML.
Thanks,
That was a typo on the post, in my file system the folder is lowercase html.

ThorHammer
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Thu Aug 25, 2016 11:28 am

Re: Custom Blog files not rendering when using module categories

Post by ThorHammer » Tue Apr 09, 2024 11:48 pm

Is this categories module behaviour expected or unexpected on an Article:blog page?
This would apply if someone could replicate the behaviour on J4.
Maybe it is a code bug if verified?

I am not a coder, more a tinkerer so bear with me please.
I am trying to follow instructions in the book: Developing Extensions for Joomla! 5, I am trying to gain a better understanding of J4/J5.

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17467
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: Custom Blog files not rendering when using module categories

Post by toivo » Wed Apr 10, 2024 1:43 am

Did you create an override for the Categories module, mod_articles_categories or mod_articles_category? Those modules work independently of the component.
Toivo Talikka, Global Moderator

ThorHammer
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Thu Aug 25, 2016 11:28 am

Re: Custom Blog files not rendering when using module categories

Post by ThorHammer » Wed Apr 10, 2024 11:14 am

toivo wrote:
Wed Apr 10, 2024 1:43 am
Did you create an override for the Categories module, mod_articles_categories or mod_articles_category? Those modules work independently of the component.
Thank you toivo,

to double check I recreated these steps on my website this morning as to rule out a simple mistake.

blog.php
blog.xml
blog_children.php
blog_links.php
blog_item.php

The above were all copied from 'components/com_content/tmpl/category' ;renamed with a prefix 'custom-' and placed into
templates/MyTemplate/html/com_content/category

in the XML file these lines were altered to
<layout title="custom-blog" option="custom-blog">
<message>
<![CDATA[A custom blog]]>

I have not made override changes to Categories module, mod_articles_categories or mod_articles_category

I just discovered in my case that the categories module when placed on the same page as the custom_blog forgot I was using an override and custom blog and used the blog.php in components/category.

The only solution I have at the moment is not to use the categories module with an override of this type.
I do not understand enough about Joomla 4 to resolve this.

Once again, thank you for replying.

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17467
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: Custom Blog files not rendering when using module categories

Post by toivo » Wed Apr 10, 2024 10:46 pm

ThorHammer wrote:
Wed Apr 10, 2024 11:14 am
The above were all copied from 'components/com_content/tmpl/category' ;renamed with a prefix 'custom-' and placed into
templates/MyTemplate/html/com_content/category
That would not have worked. The override files need to have the same name as the original files.

There is no need to create overrides manually. Follow this tutorial: Joomla 4.x: Template Overrides. Please note that when several files are copied into a subfolder of the html folder but only one of those files is modified, the other files can be deleted. That keeps the override structure as simple as possible for future maintenance and possible refactoring.
Toivo Talikka, Global Moderator

ThorHammer
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Thu Aug 25, 2016 11:28 am

Re: Custom Blog files not rendering when using module categories

Post by ThorHammer » Thu Apr 11, 2024 10:25 am

toivo wrote:
Wed Apr 10, 2024 10:46 pm

There is no need to create overrides manually. Follow this tutorial: Joomla 4.x: Template Overrides. Please note that when several files are copied into a subfolder of the html folder but only one of those files is modified, the other files can be deleted. That keeps the override structure as simple as possible for future maintenance and possible refactoring.
Thank you,

This is the tutorial I was following to get me this far
https://www.joomlashack.com/blog/joomla ... ry-layout/
also this
https://github.com/brianteeman/joomla-cards

From your reply I am assuming the above is most probably a hack rather than a supported method, and I'm probably walking with crutches following it, just as I ditched one crutch nearing success I had the issues and needed a wheelchair instead.

I will read the template overrides and rethink my methods to achieve a card layout for one page of the many Article type Blog pages on my project.

Maybe using CSS overrides along with 'display: none' to hide the intro text and core features like columns would be a better strategy.

I really appreciate the help, you have saved me time by abandoning the tutorial and code snippet I was using to guide me.

SharkyKZ
Joomla! Hero
Joomla! Hero
Posts: 2924
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: Custom Blog files not rendering when using module categories

Post by SharkyKZ » Fri Apr 12, 2024 5:51 am

That tutorial is not wrong. But perhaps you have multiple category menu items and the module simply links to the one using the default layout.

ThorHammer
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Thu Aug 25, 2016 11:28 am

Re: Custom Blog files not rendering when using module categories

Post by ThorHammer » Fri Apr 12, 2024 11:30 am

SharkyKZ wrote:
Fri Apr 12, 2024 5:51 am
That tutorial is not wrong. But perhaps you have multiple category menu items and the module simply links to the one using the default layout.
I really don't know, I have now abandoned this attempt for the time being, I am now using an override Article Blog with some conditional statements.
I used $this->params->get('blog_class') to retrieve parameters i entered at Blog->Article Class and was able to implement my changes.

I did discover this which may be of help to anyone trying Overrides and Alternative Menu Items after I had implemented my changes
https://docs.joomla.org/J4.x:Template_Layouts

I may revisit this at a later date as it's irking me, but for the time being the show must go on, and I have achieved the desired changes.

Everyone has been so helpful, thank you.


Post Reply

Return to “Extensions for Joomla! 4.x”