Keyword

different background color for specific article

  • impuls
  • impuls's Avatar Topic Author
  • Offline
  • New Member
More
11 years 2 months ago #116469 by impuls
Hello,

I would like to know if it is possible to change background color for specific article in blog layout. I know that you can edit k2.css, but that changes the background color for all articles. I know that i could use for example div tag but this changes the color of the content and not the whole article with title.

Thanks for your help

Please Log in or Create an account to join the conversation.

  • Agence culturelle départementale Dordogne-Périgord
  • Agence culturelle départementale Dordogne-Périgord's Avatar
  • Offline
  • Junior Member
More
11 years 2 months ago #116470 by Agence culturelle départementale Dordogne-Périgord
Replied by Agence culturelle départementale Dordogne-Périgord on topic Re: different background color for specific article
Try creating Categories and Models. you can then have different settings per different model. Take a look in documentation, it explains how to make models (in /templates/your-template/html)

Hope this helps.

Please Log in or Create an account to join the conversation.

  • impuls
  • impuls's Avatar Topic Author
  • Offline
  • New Member
More
11 years 2 months ago #116471 by impuls

Duane Simpson wrote: Try creating Categories and Models. you can then have different settings per different model. Take a look in documentation, it explains how to make models (in /templates/your-template/html)

Hope this helps.


I don't understand what you mean with models. Do you mean modules, or templates ? Cause when I want to edit template, I can only edit the look of all artices, and not specific ...

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 2 months ago #116472 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: different background color for specific article
Duane means templates. You can also edit category_item.php and use a different CSS class for its container, perhaps the item id. Then without any new override you will have a distinct CSS class which you can use to style every single item.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • impuls
  • impuls's Avatar Topic Author
  • Offline
  • New Member
More
11 years 2 months ago #116473 by impuls

Krikor Boghossian wrote: Duane means templates. You can also edit category_item.php and use a different CSS class for its container, perhaps the item id. Then without any new override you will have a distinct CSS class which you can use to style every single item.


That sounds like a good idea, maybe i could add class " article# " (# = article number), to the container. But my php skills are really bad, and can't think how i would make such thing ... but i know that i will probabbly need to add it in category.php, at line 207 :

<div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->secondary)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_secondary_columns'), 1).'%;"'; ?>>
<?php
// Load category_item.php by default
$this->item=$item;
echo $this->loadTemplate('item');
?>
</div>

correct me, if I am wrong.

Please Log in or Create an account to join the conversation.

More
10 years 10 months ago #116474 by Brigitte
Hi impuls,

I have the same problem, could you solve it?? Can you help??

Or can somebody else help??


Best Regards

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 10 months ago #116475 by Yiota
It depends on where you need to add the background color. If you need it in the whole page then the item id code snippet for the class addition should be in the index.php of your template. If you need the background color to be in the K2 item container only then you need to add your code snippet in the item.php of your K2 overrides.

Let me know which of the two is your case in order to provide further information.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum