Page 1 of 1

Changing article background color [Solved]

Posted: Fri Feb 20, 2009 12:12 am
by PhilOSparta
J1.5.9 with Ja_Purity.
The objective was to change the background color of an article using the Page Class Suffix setting in the menu.
There is a well written tutorial for this technique at http://docs.joomla.org/Tutorial:Using_C ... oomla!_1.5 , and it uses the Milky Way template. It works fine, but when trying to use it with ja_purity it doesn't work.

I found that JA Purity over-rides the html/com_content/article/default.php file to accomplish much of its look. I had to add a small snippet of code for each occurrence of a class=.
Example:
Everywhere you see a class declared with no pageclass_sfx call

Code: Select all

class="article-content"
Change by adding the call:

Code: Select all

class="article-content<?php echo $this->params->get( 'pageclass_sfx' ); ?>"
Next, add your own custom CSS in template.css
Example: Providing yellow, green and blue backgrounds to articles.
#ja-content .yellowBack { background-color: #ffffbf; }
#ja-content .greenBack { background-color: #bfffbf; }
#ja-content .blueBack { background-color: #c8c8ff; }

The stated examples work on single articles accessed by menu tabs that have their Page Class Suffix set to
<space>yellowBack etc. per the tutorial.

A further note, this works on "articles" in a menu article layout. If you want to do it in a blog, frontpage or section layout, you will have to make similar changes to the respective html/com_content/xxx files.

Phil