 |

gethudson
Novice
May 20, 2008, 3:57 AM
Post #1 of 4
(282 views)
Shortcut
|
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!?!?!
|
|
|  |
 |

Dave
Staff
/ Moderator

May 20, 2008, 10:02 AM
Post #2 of 4
(272 views)
Shortcut
|
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
|
|
|  |
 |

Perchpole
User
May 24, 2008, 2:04 PM
Post #3 of 4
(229 views)
Shortcut
|
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?
|
|
|  |
 |

Dave
Staff
/ Moderator

May 24, 2008, 2:56 PM
Post #4 of 4
(226 views)
Shortcut
|
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
|
|
|  |
|