Jump to content
xisto Community
irishpeck

Help With The Latest Ads Section Of Our Classifieds Website

Recommended Posts

Hey we have decided to just put the latest ads section at the top so can you help me with two things? One could you help me edit the script so only 5 show up and then the next 5 go to the next line and Two could you help me could you help us keep all the pictures the same size? Basically the images are being sized using a config.inc.php but its not working right because they are different sizes. Sorry for all these problems and once again i cant thank you enough for all this work

<?phprequire_once("config.inc.php");?><?phpif($latestads_count){?><?php	$sql = "SELECT a.*, ct.cityname, UNIX_TIMESTAMP(a.createdon) AS timestamp, feat.adid AS isfeat,				COUNT(*) AS piccount, p.picfile AS picfile, scat.subcatname, scat.catid, cat.catname			FROM $t_ads a				INNER JOIN $t_cities ct ON a.cityid = ct.cityid				INNER JOIN $t_subcats scat ON a.subcatid = scat.subcatid				INNER JOIN $t_cats cat ON scat.catid = cat.catid				LEFT OUTER JOIN $t_featured feat ON a.adid = feat.adid AND feat.adtype = 'A' AND feat.featuredtill >= NOW()				LEFT OUTER JOIN $t_adpics p ON a.adid = p.adid AND p.isevent = '0'			WHERE $visibility_condn				$loc_condn			GROUP BY a.adid			ORDER BY a.createdon DESC			LIMIT $latestads_count";	$res_latest = mysql_query($sql) or die($sql.mysql_error());	$css_first = "_first";	while($row = mysql_fetch_array($res_latest))	{	   		$catname_inurl = RemoveBadURLChars($row['catname']);		$subcatname_inurl = RemoveBadURLChars($row['subcatname']);		if($sef_urls) $url = "{$vbasedir}$xcityid/posts/{$row[catid]}_{$catname_inurl}/{$row[subcatid]}_{$subcatname_inurl}/$row[adid]_" . RemoveBadURLChars($row['adtitle']) . ".html";		else $url = "?view=showad&adid=$row[adid]&cityid=$xcityid〈=$xlang{$link_extra}";?>   		<?php		if($row['isfeat'])		{			//$feat_class = "class=\"featured\"";			$feat_img = "<img src=\"images/featured.gif\" align=\"absmiddle\">";		}		else		{			//$feat_class = "";			$feat_img = "";		}		if($row['picfile'])		{			$picfile = $row['picfile'];			$imgsize = GetThumbnailSize("{$datadir[adpics]}/{$picfile}", $tinythumb_max_width, $tinythumb_max_height);		}		else		{			$picfile = "";		}		?>		 			<?php if($picfile) { ?>			<a href="<?php echo $url; ?>"><img src="<?php echo "{$datadir[adpics]}/{$picfile}"; ?>" border="0" width="<?php echo $imgsize[0]; ?>" height="<?php echo $imgsize[1]; ?>" style="border:1px solid black"></a>			<?php } ?>		   <?php		$css_first = "";	}?></div><?php}?>

Share this post


Link to post
Share on other sites

Looking at your site it looks like you got it now (since this looks like an old post anyway)...I don't know how you solved your problem but a way you can go about it would have been adding a counter and an if statement in your while loop, or, and much more lean (especially if you have a unique id/counter in your database already) would be to drop the counter and use a mod (%). if you need either of these explained in detail still just let me know and I'll be happy to.

Share this post


Link to post
Share on other sites

Hi!To set the number of the latest posts, you have to type this line into the file just after the require_once statement:$latestads_count = 5;Regarding the images, you've got 2 kinds of images - featured item images and regular images. Do you want both the featured and regular items to appear the same size?Regards,Nitin Reddy

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.