Forum Moderators: coopster

Message Too Old, No Replies

change php file to allow for rows and columns

rows and columns

         

ahartwick

10:21 pm on Mar 28, 2011 (gmt 0)

10+ Year Member



I would like to know what code to add to this default.php file to allow for two rows, each row containing four listings... I would also like to move the title and price above or below the image... I have tried to simply copy and paste an example that I found, which did not work.

Any help would be greatly appreciated!

<?php

/**

* @author Sanjeev Shrestha

* Default Template for Featured

*/

defined('_JEXEC') or die('Restricted access');





$baseurl=JUri::root()."images/ads";

$basepath=JPATH_ROOT.DS."images".DS."ads";



?>



<?php if(count($lists)>0) {?>

<table border="0" cellpadding="2">

<?php foreach($lists as $l){

$linkx=JRoute::_("index.php?option=com_joomlistings&c=ad&task=view&adid=".$l->id,false);

$img_src = "";

if(file_exists($basepath.DS.$l->userid.DS.$l->image."_sthm.jpg")){

$img_src = $baseurl."/".$l->userid."/".$l->image."_sthm.jpg";

}

elseif(file_exists($basepath.DS.$l->userid.DS.$l->image."_thm.jpg")){

$img_src = $baseurl."/".$l->userid."/".$l->image."_thm.jpg";

}else{

$xurl=JUri::base()."components/com_joomlistings/images";

$img_src = $xurl."/noimage_sthm.jpg";

}

?>

<tr>

<td><a href="<?php echo $linkx; ?>"><img src="<?php echo $img_src;?>" /></a></td>

<td valign="top"><a href="<?php echo $linkx; ?>"><strong><?php echo $l->title; ?> </strong></a>

<?php if($l->price>0){?>

<div class="price">

<?php echo $l->currencysymbol; ?> <?php echo number_format($l->price,2); ?> <?php echo $l->currency; ?>

</div>

<?php }?>

</td>

</tr>

<?php

}

?>

</table>

<?php

}

else

{

echo JText::_('NO_ADS');

}

?>

coopster

1:17 am on Apr 2, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, ahartwick.

PHP writes out whatever you instruct so creating more rows or columns means that you merely need to modify the output.