I apologize for not being clearer. The output is given is 2 rows, i column of the last entry in the database. The class definitions, I think you are talking about my parameters are:
HowMany = 3 // Limit number of entries you want to display.
Alignment = 1 // Display vertical or horizontal. Vertical=1 Horizontal=2
LineColor1 = #FFFFFF // Column color setting in Horizational alignment
LineColor2 = #EBE7E7 // Column color setting in Horizational alignment
ColumnSize = 3 // Number of columns per row in Horizational alignment
ColumnWidth = 100 // Size of each column in pixels in Horizational alignment
The code is only part of the script. The first part when the parameter is set to vertical display works perfect. But when I try to set the parameter to display horizontal is where I'm stuck. I did some search and found 4 snipplets that I thought might do the trick, but they were all failures. The one that I've shown here I've used it once a few years ago and it worked then, but the query was written a little different.
Here is the complete script:
# Don't allow direct acces to the file
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
# Set path to config file
require($mainframe->getCfg( 'absolute_path' )."/administrator/components/com_estateagent/configuration.php");
# Module Parameter Settings
$HowMany = @$params->HowMany ? $params->HowMany : '5';
$Alignment = @$params->Alignment ? $params->Alignment : '1';
$LineColor1 = @$params->LineColor1 ? $params->LineColor1 : '#FFFFFF';
$LineColor2 = @$params->LineColor2 ? $params->LineColor2 : '#EBE7E7';
$ColumnSize = @$params->ColumnSize ? $params->ColumnSize : '5';
$ColumnWidth = @$params->ColumnWidth ? $params->ColumnWidth : '100';
### DONT EDIT BELOW THIS LINE #################################################
# Set path to thumbnails
$picturepath = $mosConfig_live_site.$ea_picpath."/";
$query="SELECT
t1.id, t1.obj_cat, t1.obj_title, t1.obj_publish,
t1.obj_pub_start, t1.obj_pub_stop, t2.img_id, t2.obj_img1, t3.cat_id, t3.cat_name
FROM
#__estateagent_object AS t1
LEFT JOIN #__estateagent_images AS t2 ON t2.img_id=t1.id
LEFT JOIN #__estateagent_category AS t3 ON t3.cat_id=t1.obj_cat
WHERE
(
(
(
(
t1.obj_pub_start >= '0000-00-00 00:00:00'
AND
t1.obj_pub_start <= '$todate 23:59:59'
)
AND
(
t1.obj_pub_stop <= '$todate 23:59:59'
AND
t1.obj_pub_stop >= '$todate 00:00:00'
)
)
OR
(
(
t1.obj_pub_start >= '0000-00-00 00:00:00'
AND
t1.obj_pub_start <= '$todate 23:59:59'
)
AND
t1.obj_pub_stop >= '$todate 23:59:59'
)
OR
(
t1.obj_pub_stop >= '$todate 00:00:00'
AND
t1.obj_pub_stop <= '$todate 23:59:59'
)
OR
(
t1.obj_pub_start = '0000-00-00 00:00:00'
AND
t1.obj_pub_stop = '0000-00-00 00:00:00'
)
)
AND
t1.obj_publish='1'
)
ORDER BY t1.id DESC LIMIT $HowMany";
# Query the database
$database->setQuery( $query );
$rows = $database->loadObjectList();
$row=$rows[0];
# Put the output on screen
if ($Alignment == '1') {
foreach($rows as $row) {
$content .= "<center><a href='index.php?option=com_estateagent&Itemid=0&func=showObject&objid=$row->id'><b>$row->cat_name</b><br>";
if($id != $row->img_id) {
$sm_pic = "<img src='".$picturepath."thmb_".$row->obj_img1."' border='0' alt='$row->obj_title'>";
} else {
$sm_pic = "<img src='". $mosConfig_live_site."/components/com_estateagent/obj_pictures/nopic.png' border='0' alt='$row->obj_title'>";
}
$content .= "$sm_pic";
$content .= "<br><font size='1'>$row->obj_title</font></a></center><br>";
}
}
if ($Alignment == '2') {
$content ="<div align='center'><table width='100%' border='1' cellspacing='2' cellpadding='0'><tr>";
$column=1;
if ($column>$HowMany) {
$column=1;
$content .="</tr><tr>";
}
if($id != $row->img_id) {
$sm_pic = "<img src='".$picturepath."thmb_".$row->obj_img1."' border='0' alt='$row->obj_title'>";
} else {
$sm_pic = "<img src='". $mosConfig_live_site."/components/com_estateagent/obj_pictures/nopic.png' border='0' alt='$row->obj_title'>";
}
$content .="<td
align='center' width='$ColumnWidth'><a
href='index.php?option=com_estateagent&Itemid=0&func=showObject&objid=$row->id'><b>$row->cat_name</b><br>$sm_pic<br><font
size='1'>$row->obj_title</font></a></td>";
$column++;
if (substr($content, -$ColumnSize)!="</tr>") {
$content .="</tr>";
}
$content .="</table></div>";
echo $content;
}
You can see the output at My Temp Site .