Switching links on programs

4 posts by 3 authors in: Forums > CMS Builder
Last Post: May 13, 2009   (RSS)

Hello,

My client needs to have 2 separate outcomes for a listing depending on what fields are entered in the CMSadmin.

He has 2 separate fields that need to be linked to the main title of the program. Either a link to a file that he uploads OR a website URL that he would like to link it to.

Right now i have this currently as my PHP code for the title linked to the uploaded file:

<?php foreach ($record['file'] as $upload): ?><a href="<?php echo $upload['urlPath'] ?>"><?php echo $record['title'] ?></a><?php endforeach ?>

But if i do not upload a file, the title doesn't display at all.

So in the absence of an uploaded file, i would like to place a URL link instead. My URL link would be from this field in the admin: <?php echo $record['web_link'] ?>

Is there a way to do an if/else statement that will work with one or the other depending on the field that is entered in the admin?

Thanks in advance!

Re: [interchanges] Switching links on programs

By Damon - May 12, 2009

Hi,

Trying using this code to only display the web link if there is no uploads:

<?php if(!$record['file']) : ?>
<?php echo $record['web_link'] ?><br />
<?php endif ?>

Hope that helps.
Cheers,
Damon Edis - interactivetools.com

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

Re: [interchanges] Switching links on programs

By ross - May 13, 2009

Hi there.

Could you post a link to the page you are working on? I'd like to see your code in action.

Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/