Tricky Formating

7 posts by 2 authors in: Forums > CMS Builder
Last Post: April 27, 2010   (RSS)

Hi there,

I have a list of destinations which show up in my list viewers like this:

Destinations: <?php echo join(', ', getListLabels('yachts', 'destinations', $record['destinations'])); ?>

Which outputs text like:

Destinations: Australia, Tahiti, New Zealand

How would I go about dropping in a link on each destination seeing as this is being stored in the table like this:

" 1 11 10 "

Many thanks
Jan

Re: [aquaman] Tricky Formating

By Jason - April 26, 2010

Hi,

So you would like to display "Australia", "Tahiti", and "New Zealand" as links? What page would you want it to link to?

We can do this, but it would require some extra coding. If you could attach the file that you're working with, along with the page you would like the link to go to, I can take a look at it for you.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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

Re: [Jason] Tricky Formating

Hi Jason,

Here is a page we want to link from:

http://luxurychartergroup.dreamhosters.com/yacht-type.php/sailing-1/
See attached file: yacht-type.php

links to:

http://luxurychartergroup.dreamhosters.com/destination.php/tahiti-11/
See attached file: destination.php

Thanks for the help...
Jan

Re: [Jason] Tricky Formating

Hi Jason, that worked great.

One last question, How do I go about removing the comma from the last item?

e.g. currently displays as:

Destinations: Australia, Tahiti,

would like to show it as:

Destinations: Australia, Tahiti

Re: [aquaman] Tricky Formating

By Jason - April 27, 2010

Hi,

You can try replacing where you are displaying your destinations with this:
<?php $count=0; ?>
<?php foreach ($valuesToLabels as $value => $label): ?>
<?php echo ($count==0)? "" : "," ?>
<a href="destination.php/<?php echo $label."-".$value ?>"><?php echo htmlspecialchars($label); ?></a>
<?php $count++;?>
<?php endforeach ?><br/>


Give that a try and let me know if that works for you.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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

Re: [Jason] Tricky Formating

Thanks Jason, all sorted.