Hello 🙂, I have the older code partially working at the moment, in that it will display either a single, two-column or three-column layout, but there is an issue with the three-column layout which is as follows..
If I set the module to display 6 items, it will do so correctly when either a single or two-column layout is enabled. If I choose to display a three-column layout, the code shows 2 of the 6 items and shows them 3 times each in each of the 3 columns.
It can be seen here - http://www.tomsspecialreserve.co.uk/joomla
I cannot get the new code you posted to currently output anything, nothing is being outputted so Im still trying to work with the older code which is at least outputting the correct number of columns, but incorrect items :rolleyes:
(i've included the whole code here, sorry that it is rather long!)-
<?php
// no direct access
defined('_JEXEC') or die('Restricted access');
$centreColumn = '';
$rightColumn = $leftColumn = '';
$firstColumn = $secondColumn = $thirdColumn = '';
for ($b = 0; (($this->news_amount - ($b * $this->news_column)) > 0); $b++) {
for ($c = 0, $column = 0; $c < $this->news_column; $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';
}
elseif ($this->news_column == 3)
{
if($column == 0)
{
$div_class = 'first_column_class';
}
elseif($column == 1)
{
$div_class = 'second_column_class';
}
elseif($column == 2)
{
$column = 0;
$div_class = 'third_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
//Start Three Columns here
if ($c == 0 && $this->news_column > 2){
//Start First Column Rounded Corners option
if ($this->firstcolumnroundedcorners) {
$firstColumn .= '<div class="roundedflexable"><div><div><div>'."\n";
if (isset($news_code_html_tab[$column])) {
$firstColumn .= $news_code_html_tab[$column];
}
}
//Start First Column Squared Corners option
elseif ($this->firstcolumnsquaredcorners) {
$firstColumn .= '<div class="squared">'."\n";
if (isset($news_code_html_tab[$column])) {
$firstColumn .= $news_code_html_tab[$column];
}
}
//End First Column Rounded Corners option
if ($this->firstcolumnroundedcorners) {
$firstColumn .= '</div></div></div></div>'."\n";
}
//End First Column Squared Corners option
elseif ($this->firstcolumnsquaredcorners) {
$firstColumn .= '</div>'."\n";
}
//Start Second Column Rounded Corners option
if ($this->secondcolumnroundedcorners) {
$secondColumn .= '<div class="roundedflexable"><div><div><div>'."\n";
if (isset($news_code_html_tab[$column])) {
$secondColumn .= $news_code_html_tab[$column];
}
}
//Start Second Column Squared Corners option
elseif ($this->secondcolumnsquaredcorners) {
$secondColumn .= '<div class="squared">'."\n";
if (isset($news_code_html_tab[$column])) {
$secondColumn .= $news_code_html_tab[$column];
}
}
//End Second Column Rounded Corners option
if ($this->secondcolumnroundedcorners) {
$secondColumn .= '</div></div></div></div>'."\n";
}
//End Second Column Squared Corners option
elseif ($this->secondcolumnsquaredcorners) {
$secondColumn .= '</div>'."\n";
}
//Start Third Column Rounded Corners option
if ($this->thirdcolumnroundedcorners) {
$thirdColumn .= '<div class="roundedflexable"><div><div><div>'."\n";
if (isset($news_code_html_tab[$column])) {
$thirdColumn .= $news_code_html_tab[$column];
}
}
//Start Third Column Squared Corners option
elseif ($this->thirdcolumnsquaredcorners) {
$thirdColumn .= '<div class="squared">'."\n";
if (isset($news_code_html_tab[$column])) {
$thirdColumn .= $news_code_html_tab[$column];
}
}
//End Third Column Rounded Corners option
if ($this->thirdcolumnroundedcorners) {
$thirdColumn .= '</div></div></div></div>'."\n";
}
//End Third Column Squared Corners option
elseif ($this->thirdcolumnsquaredcorners) {
$thirdColumn .= '</div>'."\n";
}
}
//End Third 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
if (!empty($firstColumn))
{
echo '<div id="'.$this->first_column_id.'">'."\n";
echo $firstColumn;
echo '</div>'."\n";
}
if (!empty($secondColumn))
{
echo '<div id="'.$this->second_column_id.'">'."\n";
echo $secondColumn;
echo '</div>'."\n";
}
if (!empty($thirdColumn))
{
echo '<div id="'.$this->third_column_id.'">'."\n";
echo $thirdColumn;
echo '</div>'."\n";
}
//End TEST OUTPUT FROM FIRST SECOND THIRD COLUMNS here
?>