Keyword

Add Custom CSS to category

  • Webmaster
  • Webmaster's Avatar Topic Author
  • Offline
  • New Member
More
8 years 11 months ago #143814 by Webmaster
Add Custom CSS to category was created by Webmaster
Dear webdevelopers,

I have made an template with artisteer and uploaded to my site joomla.vv-gestel.com. After that we have started implementing some data in the site. At this moment there are two modules of K2 Content on the home page. They both use the k2.css from the default component. I've added the template directory to my html folder in the template.

I can see that the template works because when i edit the item.php with an extra text to the title it is shown when i open the event. I wan't to disable the bottom border in the events on the right side of the site. I can see that this is configured by the k2.css file. I would like to override this file from the html folder. The file is called event_style.css.

Can anyone assist me to get the custom stylesheet working.

Thanks for all your support,

Patrick

p.s. If you need some more information, please let me know.
The topic has been locked.
  • Webmaster
  • Webmaster's Avatar Topic Author
  • Offline
  • New Member
More
8 years 11 months ago #143815 by Webmaster
Replied by Webmaster on topic Add Custom CSS to category
Dear readers,

I forgot to mention the override is chosen in the K2 category. In the module is specified that only articles with that category is listed in the module.

Greetings Patrick
The topic has been locked.
  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 11 months ago #143831 by Krikor Boghossian
Replied by Krikor Boghossian on topic Add Custom CSS to category
You will need to the stylesheet via this method -> docs.joomla.org/JDocument/addStyleSheet

An alternate method would be having all the styles in a single file and separating them by the body class or the container's class the template offers.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
The topic has been locked.
  • Webmaster
  • Webmaster's Avatar Topic Author
  • Offline
  • New Member
More
8 years 11 months ago #143837 by Webmaster
Replied by Webmaster on topic Add Custom CSS to category
I've added $this->addStyleSheet( 'templates/' . $this->template . '/html/com_k2/templates/eventoverride/event_style.css' );. This doesn't have the result i'm lokking for.

After that i entered the code below to item.php but this still does not work.

$doc =& JFactory::getDocument();
$doc->addStyleSheet( 'joomla.vv-gestel.com/html/templates/com_k2/templates/eventoverride/event_style.css' );

Do you have another idea.

Thanks in advance,

Patrick
The topic has been locked.
  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 11 months ago #143850 by Krikor Boghossian
Replied by Krikor Boghossian on topic Add Custom CSS to category
$doc = JFactory::getDocument();
$doc->addStyleSheet( JURI::base(true).'templates/YOUR_TEMPLATE/PATH_TO_FILE');

This should do the trick.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
The topic has been locked.
  • Webmaster
  • Webmaster's Avatar Topic Author
  • Offline
  • New Member
More
8 years 11 months ago #143864 by Webmaster
Replied by Webmaster on topic Add Custom CSS to category
Hello Krikor,

Thanks for your reply. Do i need to place this code in the category.php or the item.php. Do you also know where to put the code in php file. I'm not that experienced with PHP yet.

Thanks in advance,

Patrick
The topic has been locked.
  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 11 months ago #143913 by Krikor Boghossian
Replied by Krikor Boghossian on topic Add Custom CSS to category
There are several methods for this.
The most efficient would be to check if you template has a helper file.

You can see how other stylesheets are being loaded and load this file based on either the menu item or the category.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
The topic has been locked.
  • Webmaster
  • Webmaster's Avatar Topic Author
  • Offline
  • New Member
More
8 years 11 months ago #144070 by Webmaster
Replied by Webmaster on topic Add Custom CSS to category
Hello Krikor,

I've tried to accomplish what you have replied to me but i'm stille not getting it to work. Should there not also be an eassier way to edit the layout in different content modules from K2.

Thanks in advance,

Patrick
The topic has been locked.
  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 10 months ago #144088 by Krikor Boghossian
Replied by Krikor Boghossian on topic Add Custom CSS to category

An alternate method would be having all the styles in a single file and separating them by the body class or the container's class the template offers.


I would personally use this method instead. For modules you can use the module's suffix.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
The topic has been locked.
  • Webmaster
  • Webmaster's Avatar Topic Author
  • Offline
  • New Member
More
8 years 10 months ago #144445 by Webmaster
Replied by Webmaster on topic Add Custom CSS to category
Some how i don't get it to work with either of your solutions. Is there a manual written about this topic somewhere.

Thanks in advance,

Patrick
The topic has been locked.

Powered by Kunena Forum