 |

Perchpole
User
Mar 30, 2008, 5:35 PM
Post #1 of 4
(267 views)
Shortcut
|
|
Listpage Links
|
Can't Post
|
|
Hi, Dave - Here' a quick teaser for you. Scenario: I have a list page set-up so that all of the article titles act as links to the corresponding article pages. All of the articles include some sort of text. Most also include an image upload. A few have neither text nor an image upload. Question: How can I deactivate/disable the links on the list page to those pages without image uploads? I assume this would invlove some sort of "if" argument - but I'm not sure how to set it up. Wibble....
AJ
|
|
|  |
 |

Dave
Staff
/ Moderator

Mar 31, 2008, 10:23 AM
Post #2 of 4
(258 views)
Shortcut
|
|
Re: [Perchpole] Listpage Links
[In reply to]
|
Can't Post
|
|
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
|
|
|  |
 |

Perchpole
User
Mar 31, 2008, 11:37 AM
Post #3 of 4
(248 views)
Shortcut
|
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.
AJ
|
|
|  |
 |

Perchpole
User
Mar 31, 2008, 1:24 PM
Post #4 of 4
(239 views)
Shortcut
|
|
Re: [Perchpole] Listpage Links
[In reply to]
|
Can't Post
|
|
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
|
|
|  |
|