View Full Version : Modiying PHP code for a Joomla module?

08-29-2009, 11:24 AM
Hello forum :)

I need some help modifying a secton of PHP code which is used in a module for displaying news article headlines.

The code snippet allows for either a single-column or a two-column layout.

What I would love to do is add a THIRD column to produce a 3 column layout if desired.

The single-column layout class is called "singleColumn", and the two-column layout class is called "firstColumn" and "secondColumn".

I have this snippet from my default.php module code, but I don't really know how to add the option for a third column, can anyone help, I would be very greatful :)

$singleColumn = '';
$firstColumn = $secondColumn = '';
for ($b = 0; (($this->news_amount - ($b * $this->news_column)) > 0); $b++) {

for ($c = 0; $c < $this->news_column; $c++) {

if ($this->news_column == 1) {
$div_class = 'single_column_class';
} elseif ($this->news_column == 2) {
$div_class = ($c == 0) ? 'first_column_class' : 'second_column_class';

$column = ($b * $this->news_column) + $c;

Im not sure how to code to allow for a third column, could anyone help me out?