View Full Version : PHP and Joomla code help needed please

03-05-2009, 08:59 AM
Hello I have a Joomla 1.5.9 and PHP question, which Im hoping someone can help me out with -

I want to apply different individual styles to my frontpage articles. Not just the usual single page class suffix style which applies to the whole page.

I have 2 article categories (category1 and category2) and I need different styling for each category. For example, articles in category 1 will have different styling for articles in category2. This is just for the front page only.

I am using the Beez template (default.php and default_item.php).

The standard joomla code to output a page class suffix is -

<div class="contentpaneopen_edit<?php echo $this->item->params->get('pageclass_sfx'); ?>">

The code above lets you give a whole page an overall class suffix and outputs html as -
div class="contentpaneopen">

I found this php code below which is supposed to output the page class suffix AND the category of the article as a suffix (so css styling can be applied to each article), but I just cannot get it to work -

<div class="contentpaneopen<?php echo $this->item->params->get( 'pageclass_sfx' ) . '-' . $this->item->category; ?>">

The code is supposed to output html as the following -

<div class="contentpaneopen-CATEGORYHERE">

But the category isnt displayed in the html when I view the source.

I am hopeless with php and really stuck on this one, I hope my question has made sense :)