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

Home: Products: CMS Builder:
List & Detail - linking to an external file

 

 


rsekaly
User

Sep 27, 2008, 8:59 PM

Post #1 of 3 (346 views)
Shortcut
List & Detail - linking to an external file Can't Post

I have a site which has a multi-record viewer. Two of the records are normal (title, summary, content). However, one of the records is a link to a pdf file (hyperlink in content field to pdf). As you can guess, this is very ugly, as you have to go from the list (title, summary) to the detail (title, content) page, then select the hyperlink.

Is there a cleaner way of doing the same thing?

Thanx........ ragi
--
Ragi Sekaly


Mr Jim
User


Sep 28, 2008, 2:26 PM

Post #2 of 3 (269 views)
Shortcut
Re: [rsekaly] List & Detail - linking to an external file [In reply to] Can't Post

One way would be to create a new field in your section to handle the external file link rather than putting it in the content section. Then, in your list page, use a conditional statement to determine exactly which field from your section is going to be used as the link.

Example:

Add a textfield to your section. Title it, for example, external_link. Now, in the record where you want to link to a pdf rather than move to a detail page, instead of placing any content in the content field, place the link url into the external_link field. Then save it.

In your list page code, right after the line <?php foreach ($xxxxxRecords as $record): ?>, add the following code:


Code
<?php if ( !empty($record['external_link']) ) { 
$new_link = $record['external_link'];
} else {
$new_link = $record['_link'];
} ?>


Then, where your code declares the url that should be used as the link, change:

<a href="<?php echo $record['_link'] ?>">

to:

<a href="<?php echo $new_link ?>">

Then, when you browse to your list page, the code will check to see if the new external_link field has something in it. If it does, then it will now use what's in that field for the link.

Hope this helps somewhat.

Jim
WebCamp One, LLC
The Web Done Right


rsekaly
User

Sep 28, 2008, 3:09 PM

Post #3 of 3 (266 views)
Shortcut
Re: [Mr Jim] List & Detail - linking to an external file [In reply to] Can't Post

That's great!

Thanx a lot Jim, it worked perfectly.
--
Ragi Sekaly

 
 
 


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