Multi-Select Roundabout!

5 posts by 2 authors in: Forums > CMS Builder
Last Post: September 13, 2010   (RSS)

Hi, All

I'm having one of those days where the simplest of problems is causing my brain to turn to cheese!

I want to use the data from a multi-select menu on a detail page - but I simply can't work out how to do it!

In this instance, each Value is a URL and each Label is the name of a website. The idea is that the author can select from a pre-configured pool of websites and show these as a list of links beneath an article.

Should be simple but it just ain't happenin' today!

Wibble...

Perch

Re: [Perchpole] Multi-Select Roundabout!

By Jason - September 13, 2010

Hi,

If you could attach the .php file you're currently working with, I can take a look at this for you.

Thanks.
---------------------------------------------------
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: [Perchpole] Multi-Select Roundabout!

By Jason - September 13, 2010

Hi Perch,

Try something like this:

First, we're going to combine your two arrays into one:

$offsite_items = array_combine($record['offsite_items:values'],$record['offsite_items:labels']);

Next, we just need to output them:

<ul>
<?php foreach ($offsite_items as $value => $label): ?>
<li><a href="<?php echo $value;?>"><?php echo $label;?></a></li>
<?php endforeach ?>
</ul>


That should do it.

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] Multi-Select Roundabout!

Brilliant!

Thanks Jason. These things are so bloomin' easy when you know how!

:0)

Perch