a unique class for the site Topic is solved

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.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
KristofKier
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Jul 06, 2022 9:29 am

a unique class for the site

Post by KristofKier » Wed Jul 06, 2022 10:15 am

Hi,

For Joomla 3.10

I have created a menu item that displays an preview of articles from the selected category. Currently I also have the class for the page the same as the menu alias. Responsible for it

Code: Select all

 <body class="<?php echo $active->alias; ?>">
When I open an article on this subpage, it also displays with the same class as the review of articles in the category.
How to give a unique class to a selected article?
what should i add to the body section?

Thanks for all the help

User avatar
JTema
Joomla! Guru
Joomla! Guru
Posts: 711
Joined: Sun Apr 13, 2008 8:10 pm

Re: a unique class for the site

Post by JTema » Wed Jul 06, 2022 10:57 am

Article id may be a unique class. You can add it using php as you made for body class.
http://www.joomlatema.net - Joomla Extensions and Templates
https://amitza.joomlatema.net - Amitza Professional Responsive Joomla Template

KristofKier
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Jul 06, 2022 9:29 am

Re: a unique class for the site

Post by KristofKier » Wed Jul 06, 2022 12:16 pm

OK, this is an idea, but each article will have a different class. I wanted the website to display other modules when the page presents a category view and other modules when I select an article from this category. Now it is the same menu item and the same class. I have no way to distinguish it.
I can't find this in the documentation. Do you know where the information on this topic is? I wanted to do so that in the view of a single article there was a different class or an additional class was added.

User avatar
JTema
Joomla! Guru
Joomla! Guru
Posts: 711
Joined: Sun Apr 13, 2008 8:10 pm

Re: a unique class for the site

Post by JTema » Wed Jul 06, 2022 7:37 pm

KristofKier wrote:
Wed Jul 06, 2022 12:16 pm
OK, this is an idea, but each article will have a different class. I wanted the website to display other modules when the page presents a category view and other modules when I select an article from this category. Now it is the same menu item and the same class. I have no way to distinguish it.
I can't find this in the documentation. Do you know where the information on this topic is? I wanted to do so that in the view of a single article there was a different class or an additional class was added.
What about to make this (I have not tried just an idea):
Create 2 different menus for the same category even with same names different aliases. First one's menu type is a category blog, second one's category list. Assign some modules to first menu item and the others to second menu item.
http://www.joomlatema.net - Joomla Extensions and Templates
https://amitza.joomlatema.net - Amitza Professional Responsive Joomla Template

KristofKier
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Jul 06, 2022 9:29 am

Re: a unique class for the site

Post by KristofKier » Thu Jul 07, 2022 7:11 am

Thanks for the ideas. I know the tip of the second menu, but somehow in this particular case, this solution does not quite suit me.
Finally, I overwritten the blog.php and article \ defult.php files by adding additional classes based on the pageclass_sfx variable, I gave info from the additional module as a subtitle and now it works beautifully. I don't understand why it is not added by default :)
Regards


Post Reply

Return to “Templates for Joomla! 3.x”