List Options

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

Re: [gethudson] List Options

By Dave - May 20, 2008

You can create another section for it or specify your list option values like this:

UK|United Kingdom

Just enter the value you want, then a pipe symbol ("|") then the label you want displayed.

Hope that helps! :)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] List Options

By Perchpole - May 24, 2008

Hi, Dave -

I've just used this technique as a category selector when creating a products on my site. I can then split up the products by means of the $options['where'] condition - which is really smart.

Just one question...

Is there any way I can call the label - not code - when inserting the record on a page?

If I use <?php echo $record['category']; ?> for example, it will return the code. Could I tweak it to return the label? (which would be useful as a Category heading)

:o)

Perchpole

PS. Yes, I do want to have my cake - and eat it?

Re: [Perchpole] List Options

By Dave - May 24, 2008

Hmm, I can't think of any simple way to do that. If you didn't have too many options you could use an if statement like this:

<?php
if ($record['category'] == "UK") { print "United Kingdom"; }
if ($record['category'] == "US") { print "United States"; }
if ($record['category'] == "CA") { print "Canada"; }
?>


Do you need to output that multiple times on your pages? Would that work?
Dave Edis - Senior Developer
interactivetools.com