List Options

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

By gethudson - May 20, 2008

Hi All,

When using Admin to set up a 'list option', I would like the option to show, for example, 'UNITED KINGDOM', but actually return 'UK', to the database. How do I achieve this in CMSBuilder? Or do I create a little section and then have the list reference it instead of hardcoding?

Have I just answered my own question!?!?! [blush]

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