No articles in this category message using category overrides

Need help with the Administration of your Joomla! 4.x site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Post Reply
GillianBPP
Joomla! Explorer
Joomla! Explorer
Posts: 251
Joined: Wed Oct 01, 2014 10:25 am

No articles in this category message using category overrides

Post by GillianBPP » Wed Jan 12, 2022 3:28 pm

Time and time again, I have created template overrides for a new category, created articles for the category and created a menu item for that category, using the new override, only to be greeted with:

"There are no articles in this category. If subcategories display on this page, they may have articles."

I have even tested - again and again - using an exact copy of the system-generated category override files, adding in the blog.xml file and renaming them all to newblog.php etc and that's before I make any of the changes to the layout.

This has happened in J3, Protostar and my own template, and in J4, Cassiopeia and my own template, on new installations and old.

I've spent days on this and am getting disillusioned with what otherwise is a great CMS.

Could it be something to do with my server settings:

Code: Select all

Setting 	Value
 
PHP Built On 	                       Linux iron.cloudhosting.co.uk 4.18.0-305.19.1.lve.el7h.x86_64 #1 SMP Thu Sep 23 11:57:48 UTC 2021 x86_64
Database Type 	                       mysql
Database Version 	               5.5.5-10.3.32-MariaDB-log-cll-lve
Database Collation 	                latin1_swedish_ci
Database Connection Collation 	utf8mb4_general_ci
PHP Version 	                        8.0.14
Web Server 	                        LiteSpeed
WebServer to PHP Interface 	litespeed
Joomla! Version 	                Joomla! 3.10.4 Stable [ Daraja ] 11-December-2021 15:02 GMT
Joomla! Platform Version 	        Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent 	                        Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0 
Apart from the Joomla! versions, the settings are the same for my J4 sites.

User avatar
Pnkr
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 153
Joined: Thu Sep 01, 2011 7:26 am
Location: Athens, Greece

Re: No articles in this category message using category overrides

Post by Pnkr » Thu Jan 13, 2022 10:18 am

I think I had the same issue on some client...

The problem was the xml or check if your naming is not correctly. Something is not right. Try and check XML again... and be sure to remove any _ or - from your file namings

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 40651
Joined: Sat Apr 05, 2008 9:58 pm

Re: No articles in this category message using category overrides

Post by Webdongle » Thu Jan 13, 2022 10:44 am

No xml is needed for a Template override nor do names need to be changed. The problem is with the edit of the file. When you make the override do it from within Admin and test before edits. Then test after each edit.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

GillianBPP
Joomla! Explorer
Joomla! Explorer
Posts: 251
Joined: Wed Oct 01, 2014 10:25 am

Re: No articles in this category message using category overrides

Post by GillianBPP » Thu Jan 13, 2022 11:59 am

Webdongle wrote:
Thu Jan 13, 2022 10:44 am
No xml is needed for a Template override nor do names need to be changed. The problem is with the edit of the file. When you make the override do it from within Admin and test before edits. Then test after each edit.
You need the xml file so that the new override appears in the list under Articles when selecting a menu item. Otherwise, there's no way (that I can see, anyway) to tell Joomla to use that particular category blog override.

You don't need an xml file if it's just an article override, though.

GillianBPP
Joomla! Explorer
Joomla! Explorer
Posts: 251
Joined: Wed Oct 01, 2014 10:25 am

Re: No articles in this category message using category overrides

Post by GillianBPP » Thu Jan 13, 2022 12:01 pm

Pnkr wrote:
Thu Jan 13, 2022 10:18 am

The problem was the xml or check if your naming is not correctly. Something is not right. Try and check XML again... and be sure to remove any _ or - from your file namings
What do you mean by 'remove any _ or - from your file namings'? Surely you need mynewblog.php and mynewblog_item.php?

Or did you mean don't have my-new-blog.php and my-new-blog_item.php?

All my override names are single words.

User avatar
Pnkr
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 153
Joined: Thu Sep 01, 2011 7:26 am
Location: Athens, Greece

Re: No articles in this category message using category overrides

Post by Pnkr » Thu Jan 13, 2022 2:23 pm

GillianBPP wrote:
Thu Jan 13, 2022 12:01 pm
Pnkr wrote:
Thu Jan 13, 2022 10:18 am

The problem was the xml or check if your naming is not correctly. Something is not right. Try and check XML again... and be sure to remove any _ or - from your file namings
What do you mean by 'remove any _ or - from your file namings'? Surely you need mynewblog.php and mynewblog_item.php?

Or did you mean don't have my-new-blog.php and my-new-blog_item.php?

All my override names are single words.
Just be sure to have the namings correctly

for example the core blog has
blog.xml
blog.php
blog_item.php

name yours accordingly
for example
myblog.xml
myblog.php
myblog_item.php

not

my-blog.xml
my-blog.php
my-blog_item.php

GillianBPP
Joomla! Explorer
Joomla! Explorer
Posts: 251
Joined: Wed Oct 01, 2014 10:25 am

Re: No articles in this category message using category overrides

Post by GillianBPP » Thu Jan 13, 2022 2:28 pm

Thanks, @Pnkr, that is exactly what I'm doing, i.e. myblog.xml

User avatar
Pnkr
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 153
Joined: Thu Sep 01, 2011 7:26 am
Location: Athens, Greece

Re: No articles in this category message using category overrides

Post by Pnkr » Thu Jan 13, 2022 2:41 pm

then maybe its a privilege issue? try and open the file from the backend as @Webdongle says and resave it.

GillianBPP
Joomla! Explorer
Joomla! Explorer
Posts: 251
Joined: Wed Oct 01, 2014 10:25 am

Re: No articles in this category message using category overrides

Post by GillianBPP » Thu Jan 13, 2022 2:50 pm

Pnkr wrote:
Thu Jan 13, 2022 2:41 pm
then maybe its a privilege issue? try and open the file from the backend as @Webdongle says and resave it.
Apart from the xml file, which has to be copied from the core code, I've done most of the work in the Joomla Admin editor. Copying, resaving, again and again. I've spent about a week on this, reconstructing my template from scratch and also using brand new installations and only using overrides in Protostar or Cassiopeia. Same result.

I've put in a ticket with my hosting providers (Krystal) to see if it's a modsecurity issue or something like that.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 40651
Joined: Sat Apr 05, 2008 9:58 pm

Re: No articles in this category message using category overrides

Post by Webdongle » Thu Jan 13, 2022 4:46 pm

GillianBPP wrote:
Thu Jan 13, 2022 11:59 am
...

You need the xml file so that the new override appears in the list under Articles when selecting a menu item. Otherwise, there's no way (that I can see, anyway) to tell Joomla to use that particular category blog override.

You don't need an xml file if it's just an article override, though.
Not quite so. You need xml file for 'Layout overrides' including 'Layout overrides' for Articles. But your OP didn't specify a 'Layout override', you said Template override
GillianBPP wrote:
Wed Jan 12, 2022 3:28 pm
Time and time again, I have created template overrides for a new category, ...
Sorry but I missed to see where you mentioned menu items. Otherwise I would have asked if you meant 'Layout overrides' and asked if you have read https://docs.joomla.org/J3.x:Layout_Overrides_in_Joomla
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
brian
Joomla! Master
Joomla! Master
Posts: 12437
Joined: Fri Aug 12, 2005 7:19 am
Location: Leeds, UK
Contact:

Re: No articles in this category message using category overrides

Post by brian » Thu Jan 13, 2022 6:34 pm

You do not need the xml for a layout override. Overrides are replacements. You are confused with Alternative Menu Items https://docs.joomla.org/J3.x:Layout_Ove ... Menu_Items
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 40651
Joined: Sat Apr 05, 2008 9:58 pm

Re: No articles in this category message using category overrides

Post by Webdongle » Thu Jan 13, 2022 7:37 pm

brian wrote:
Thu Jan 13, 2022 6:34 pm
You do not need the xml for a layout override. ...
No that is why I pointed him to https://docs.joomla.org/J3.x:Layout_Overrides_in_Joomla not https://docs.joomla.org/J3.x:Layout_Ove ... Menu_Items
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

GillianBPP
Joomla! Explorer
Joomla! Explorer
Posts: 251
Joined: Wed Oct 01, 2014 10:25 am

Re: No articles in this category message using category overrides

Post by GillianBPP » Fri Jan 14, 2022 12:13 pm

Ok. Let me clarify what I am trying to achieve:

Override #1: In order for the site owner - who has no html/css knowledge - to have the ability to add a large amount of information for a series of events (one event per article) to appear in a consistent layout, I have created a number of custom fields, including several text fields, text area, URL, media (for image), editor (to embed a Google map). I have then created a custom category blog override called 'events' with files called events.php, events_item.php and events.xml

I added about half of these custom fields to the events_item.php file something like this:

Code: Select all

<div class="events"><h3><span class="event-performer"><?php echo $this->item->jcfields[1]->value; ?></span></h3><p><span class="event-description"><?php echo $this->item->jcfields[2]->value; ?></span></div><p><!-- etc with several more fields in a defined layout with child divs and so on-->
The blog layout itself is in three columns (on a wide screen) and each article only displays some of the information fields (performer, date, time, location) at this point. There is a read more link to display the full article in a new page, this time using a layout called events.php from html > com_content > article and showing all fields including ticket information, Google map, performer bio, etc. in a different layout.

The events.xml file has been changed in line three to read

Code: Select all

	<layout title="Events Category Blog" option="Events Category Blog ">
and in line 43 to read:

Code: Select all

					default="events"
If I didn't add the custom fields to the events_item.php file and point the .xml to the new menu item type, the fields would not display in the category blog. When setting up a category blog menu item there is a tab called 'Options' and the first option is called 'Choose a layout'. This layout picks a file (default.php unless another is created) from the Joomla core files or from html > com_content > articles layouts - in this case, 'events.php' - and not from the html > com_content > category layouts. It only displays this layout when a linked title on the blog page is clicked/tapped it is then displayed on its own in a dynamically generated page.

Override #2 and #3: As above, but a different set of fields in a different layout.

Override #4: Totally different - this displays just the image and image caption from the article's Images and Links tab, one article at a time then, using custom CSS and JS, the site visitor can click/tap a forward/backward button to scroll one article after another. Again, this is so that the site owner can simply upload an optimised image and then add a caption. No worries about overwriting html in error.

So, the above have to be alternative menu items, or they won't display as required on the front end.

BUT... Joomla 4x (and possibly 3x) appears to fall over if there are more than one alternative menu item of category blog type and either displays the "there are no articles..." message or a blank component area.

I have tested several times on existing development sites and three times on a new installations on cloudaccess.host free Joomla sites using Cassiopeia as follows:
  • Created three categories
  • Created two articles for each category
  • Assigned all three categories individually to separate menu items using the default Joomla core category blog menu item type
  • In the Cassiopeia template, I created an override from the 'Create overrides' tab next to the editor tab and selected Components > com_content > category then created three new files in html > com_content > category: box.php, box_item.php and box.xml (copying the xml from the Joomla core tmpl files) and changing the description at the top of the xml file to show "Cass box category blog" in the options under Articles when setting up the menu item. The URL looks like this: "index.php?option=com_content&view=category&layout=cassiopeia:box&id=9" as it should.
  • I then modified one of the menu items and selected the new menu type "Cass box category blog" and selected one of the categories.
  • Tested on front end. OK.
  • then created another category blog override in html > com_content > category with three new files: chair.php, chair_item.php and chair.xml, amending the xml as before but with "Cass chair..." instead of "Cass box..."
  • I then modified another of the menu items and selected the "Cass chair" item type.
  • Tested on the front end. No good: "There are no articles in this category..." message.
  • Reassigned the menu item to the core Joomla category blog item type and it displays ok.
  • Deleted the second override files from html > com_content > category
  • Checked front end. Now not even the 'box' override/item works. It, too, shows the "There are no articles in this category..." message.
I would be grateful if someone could follow the same procedure and see if they can replicate this.
OR... if I'm creating these alternative menu items incorrectly, please explain. (I have read the https://docs.joomla.org/J3.x:Layout_Ove ... Menu_Items) document several times, the key point being "the presence of an XML file makes an alternative layout a menu item."

Thank you.

User avatar
brian
Joomla! Master
Joomla! Master
Posts: 12437
Joined: Fri Aug 12, 2005 7:19 am
Location: Leeds, UK
Contact:

Re: No articles in this category message using category overrides

Post by brian » Fri Jan 14, 2022 1:36 pm

Dont know if this helps but I just looked at my overrides and I did NOT change line 43 of the xml - otherwise they look pretty much the same. And yes I have multiple overrides
Code_2022-01-14_13-35-47.png
Code_2022-01-14_13-36-35.png
You do not have the required permissions to view the files attached to this post.
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/

GillianBPP
Joomla! Explorer
Joomla! Explorer
Posts: 251
Joined: Wed Oct 01, 2014 10:25 am

Re: No articles in this category message using category overrides

Post by GillianBPP » Fri Jan 14, 2022 4:01 pm

brian wrote:
Fri Jan 14, 2022 1:36 pm
Dont know if this helps but I just looked at my overrides and I did NOT change line 43 of the xml - otherwise they look pretty much the same. And yes I have multiple overrides
Thanks, Brian, but I'm afraid it doesn't help. I have exactly what you have. I haven't changed the language files, so manually changed the layout title, option and message:
box-alternative-item.jpg
Can I PM you with login details for the cloudaccess site I've set tested on for you to have a very quick look?
You do not have the required permissions to view the files attached to this post.

User avatar
brian
Joomla! Master
Joomla! Master
Posts: 12437
Joined: Fri Aug 12, 2005 7:19 am
Location: Leeds, UK
Contact:

Re: No articles in this category message using category overrides

Post by brian » Fri Jan 14, 2022 5:17 pm

OK but I wont get a chance to look at it till later tonight
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/

GillianBPP
Joomla! Explorer
Joomla! Explorer
Posts: 251
Joined: Wed Oct 01, 2014 10:25 am

Re: No articles in this category message using category overrides

Post by GillianBPP » Fri Jan 14, 2022 5:31 pm

Thank you! Tomorrow's fine.

User avatar
brian
Joomla! Master
Joomla! Master
Posts: 12437
Joined: Fri Aug 12, 2005 7:19 am
Location: Leeds, UK
Contact:

Re: No articles in this category message using category overrides

Post by brian » Fri Jan 14, 2022 7:12 pm

I can confirm that it was your change to line 43 of the xml that caused the problem.

Reverting that change and recreating the menu item resolved it.

(No idea why I needed to recreate the menu item and dont have the time to dig further into that. But that change was the cause of the problem)
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/

GillianBPP
Joomla! Explorer
Joomla! Explorer
Posts: 251
Joined: Wed Oct 01, 2014 10:25 am

Re: No articles in this category message using category overrides

Post by GillianBPP » Fri Jan 14, 2022 7:31 pm

brian wrote:
Fri Jan 14, 2022 7:12 pm
I can confirm that it was your change to line 43 of the xml that caused the problem.

Reverting that change and recreating the menu item resolved it.

(No idea why I needed to recreate the menu item and dont have the time to dig further into that. But that change was the cause of the problem)
Thank you, Brian, so much. I added two more overrides - one by clicking the override generator and renaming the generated files and the other by adding each file as a new file and pasting in the content. Both checked and displaying correctly.

On a 'real' development site I haven't had as much luck, so I'll have another look tomorrow. It may mean completely trashing the menu item and starting again.

GillianBPP
Joomla! Explorer
Joomla! Explorer
Posts: 251
Joined: Wed Oct 01, 2014 10:25 am

Re: No articles in this category message using category overrides

Post by GillianBPP » Sat Jan 15, 2022 5:35 pm

Ok. So today I have gone back to my development site. This is a Joomla 3.10x upgrade to J4.0.5x.

After a few further hiccups I got there in the end, but it doesn't seem to like the menu item type being changed. I had to do this a couple of times to get it to work.

But, I should be ready to do my client training and hand it all over next week. My first 'real' J4 site. Phew!


Post Reply

Return to “Administration Joomla! 4.x”