tomkilbourn Posted September 1, 2009 Share Posted September 1, 2009 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 <?php // no direct access defined('_JEXEC') or die('Restricted access'); $centreColumn = ''; $rightColumn = $leftColumn = ''; 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 = 'centre_column_class'; } elseif ($this->news_column == 2) { $div_class = ($c == 0) ? 'left_column_class' : 'right_column_class'; } $column = ($b * $this->news_column) + $c; //Start Centre Column here { //Start Centre Column Rounded Flexable Corners option if ($this->centrerounded) { $centreColumn .= '<div class="roundedflexable"><div><div><div>'."\n"; if (isset($news_code_html_tab[$column])) { $centreColumn .= $news_code_html_tab[$column]; } } //Start Centre Column Rounded Fixed Corners option elseif ($this->centreroundedfixed) { $centreColumn .= '<div class="gk_round_fixed"><div>'."\n"; if (isset($news_code_html_tab[$column])) { $centreColumn .= $news_code_html_tab[$column]; } } //Start Centre Column Squared Corners option elseif ($this->centresquaredcorners) { $centreColumn .= '<div class="squared">'."\n"; if (isset($news_code_html_tab[$column])) { $centreColumn .= $news_code_html_tab[$column]; } } //End Centre Column Squared Corners option if ($this->centresquaredcorners) { $centreColumn .= '</div>'."\n"; } //End Centre Column Rounded Fixed Corners option elseif ($this->centreroundedfixed) { $centreColumn .= '</div></div>'."\n"; } //End Centre Column Rounded Flexable Corners option elseif ($this->centrerounded) { $centreColumn .= '</div></div></div></div>'."\n"; } } //End Centre Column here //Start Left Column here if ($c == 0 && $this->news_column > 1) { //Start Left Column Rounded Corners option if ($this->leftrounded) { $leftColumn .= '<div class="roundedflexable"><div><div><div>'."\n"; if (isset($news_code_html_tab[$column])) { $leftColumn .= $news_code_html_tab[$column]; } } //Start Left Column Squared Corners option elseif ($this->leftsquaredcorners) { $leftColumn .= '<div class="squared">'."\n"; if (isset($news_code_html_tab[$column])) { $leftColumn .= $news_code_html_tab[$column]; } } //End Left Column Rounded Corners option if ($this->leftrounded) { $leftColumn .= '</div></div></div></div>'."\n"; } //End Left Column Squared Corners option elseif ($this->leftsquaredcorners) { $leftColumn .= '</div>'."\n"; } } //End Left Column here ///////////////////////////////////////////// //Start Right Column here if ($c != 0){ //Start Right Column Rounded Corners option if ($this->rightrounded) { $rightColumn .= '<div class="roundedflexable"><div><div><div>'."\n"; if (isset($news_code_html_tab[$column])) { $rightColumn .= $news_code_html_tab[$column]; } } //Start Right Column Squared Corners option elseif ($this->rightsquaredcorners) { $rightColumn .= '<div class="squared">'."\n"; if (isset($news_code_html_tab[$column])) { $rightColumn .= $news_code_html_tab[$column]; } } //End Right Column Rounded Corners option if ($this->rightrounded) { $rightColumn .= '</div></div></div></div>'."\n"; } //End Right Column Squared Corners option elseif ($this->rightsquaredcorners) { $rightColumn .= '</div>'."\n"; } } //End Right Column here } } //Display Output from Left Column here if (!empty($leftColumn)) { echo '<div id="'.$this->left_module_id.'">'."\n"; echo $leftColumn; echo '</div>'; } //End Left Column //Display Output from Right Column here if (!empty($rightColumn)) { echo '<div id="'.$this->right_module_id.'">'."\n"; echo $rightColumn; echo '</div>'."\n"; } //End Right Column //Display Output from Centre Column here if (!empty($centreColumn)) { echo '<div id="'.$this->centre_module_id.'">'."\n"; echo $centreColumn; echo '</div>'."\n"; } //End Centre Column ?> Quote Link to comment Share on other sites More sharing options...
tomkilbourn Posted September 1, 2009 Author Share Posted September 1, 2009 Is there anyone who can help me add the option of a third column to the code? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.