Listpage Links

4 posts by 2 authors in: Forums > CMS Builder
Last Post: March 31, 2008   (RSS)

Re: [Perchpole] Listpage Links

By Dave - March 31, 2008

Hi AJ,

Add this just inside the loop that displays your records on the list page:

<?php foreach ($listRows as $record): ?>
<?php $uploads = getUploads($options['tableName'], 'uploads', $record['num']); ?>


That will load the images into a variable so you can test if there is anything in there. Use this code to do that:

<?php if ($uploads): ?>
Has Images<br/>
<?php else: ?>
No Images<br/>
<?php endif; ?>


Just replace the "Has Images" or "No Images" with whatever you want (a link, etc) or make them blank if you don't ever want something displayed (such as when there is no images).

And then if you want to display uploads on that page, instead of "foreach getUploads" you can use this code:

<?php foreach ($uploads as $upload): ?>

Hope that helps, let me know if you need any more assistance with that. :)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Listpage Links

By Perchpole - March 31, 2008

Hi, Dave -

Thanks! This is just what I was hoping for. Unfortunately it doesn't seem to work.

I've added the code but it always returns the "else" option - despite there being several uploads in the list.

[unimpressed]

AJ

Re: [Perchpole] Listpage Links

By Perchpole - March 31, 2008

Sorry -



My fault. It does work. I think I was getting my uploads and images crossed!

<?php $uploads = getUploads($options['tableName'], 'uploads', $record['num']); ?>

I simply changed 'uploads' for 'images' and now it functions as I had anticipated.

Thanks again,

[:)]

AJ