listing page with images that link to listing

2 posts by 2 authors in: Forums > CMS Builder
Last Post: June 28, 2010   (RSS)

Re: [RapidWeb] listing page with images that link to listing

By Jason - June 28, 2010

Hi,

Using the code generator will give you pretty much all of the code you'll need. If you only want to display thumbnails when if an image exists, you'll need to change the code for that.
You could use something similar to this:

<?php if($record['UPLOADFIELD']): ?>
<?php $images = $record['UPLOADFIELD']; ?>
<?php foreach($images as $image): ?>
<?php if($image['hasThumbnail']): ?>
<img src="<?php echo $image['thumbUrlPath'];?>" width="<?php echo $image['thumbWidth'];?>" height="<?php echo $image['thumbHeight'];?>" />
<?php else: ?>
No Image Available
<?php endif ?>
<?php endforeach ?>
<?php else: ?>
No Image Available
<?php endif ?>


Obviously this is just an example, and you'd have to change names to match what you have in your database (ie. UPLOADFIELD with the name of the field where you're uploading the pictures) This will only output an image if an image has been uploaded and a thumbnail has been created for it. Otherwise it will output the text "No Image Available".

As for the question of Tables vs CSS, it comes down to personal preference. I find tables are usually quicker and easier, but there are others who would disagree. Chances are, the user will never know the difference, so go with whichever you're more comfortable with.

Hope this gets you started. Let me know if you run into any issues.

Thanks.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/