Need a simple PHP code to allow for rows and colums

Looking for volunteers to join your project? Need help with a script but can't afford to pay? Want to offer your services as a volunteer to build up your portfolio? This is the place for you...

Moderator: General Moderators

Post Reply
drumguru69
Forum Newbie
Posts: 3
Joined: Wed Mar 30, 2011 11:05 am

Need a simple PHP code to allow for rows and colums

Post by drumguru69 »

I have a Joomla based module, which shows a list of featured ads in a single column. I would like to show two rows of ads, each row consisting of four ads... I have tried to copy and paste some example php, which did not work. I was hoping someone could fill in the appropriate pieces to make the module function the way I need it to... If this is not enough information... or if more files will need to be modified to make the whole system work, then please let me know.. (I am a newbie)

Code: Select all

<?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');
				}
		?>

		

[ /syntax]
Post Reply