Home | Products | Consulting | Forums | Support | Order | 1-800-752-0455
  Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
Listpage Links

 

 


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....

Crazy

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:


Code
<?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:


Code
<?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:


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
Re: [Dave] Listpage Links [In reply to] Can't Post

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


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!


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


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

Thanks again,

Smile

AJ

 
 
 


Search for (options)
Products
CMS Builder
Article Manager
Realty Manager
Listings Manager
Order Now
Services
Priority Consulting
Support
Online Documentation
Support Forums
Support Homepage
Company Info
12 reasons to choose us!
Meet the team
Monthly newsletter
Contact Us
Toll Free: 1-800-752-0455
Phone: (604) 689-3347
Sales | Support
Conditions of Use | Privacy Policy | Copyright © interactivetools.com 2008
#201 - 2730 Commercial Drive, Vancouver BC Canada V5N 5P4