Drop down menu

7 posts by 4 authors in: Forums > CMS Builder
Last Post: July 20, 2008   (RSS)

Re: [Janet] Drop down menu

By Dave - July 17, 2008

It's not a feature of CMS Builder, no, but it can be done with a little bit of custom programming. Try adding the code in red:

<form method="get" action="coursesList.php">
<select name="Semester">
<?php foreach ($listRows as $record): ?>
<?php
if (@$lastSemester == $record['semester']) { continue; } // skip this one
$lastSemester = $record['semester']; // keep track of last seen semester
?>

<option value="<?php echo $record['semester'] ?>"> <?php echo $record['semester'] ?> </option>
<?php endforeach ?>
</form>


Let me know if that works for you! :)
Dave Edis - Senior Developer

interactivetools.com

Re: [Dave] Drop down menu

By Janet - July 17, 2008

Hey Dave - do you ever sleep?

Thanks again for your quick response. Your code worked great once I realized my mistake. I use Dreamweaver in conjunction with CMS Builder so when I created the menu I used the "List Menu" format. Time for a vacation.

Here's the snippet I ended with:

In the head tags:
<script type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>

Inside the body tag:

<select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('parent',this,0)">
<option>Select Semester</option>
<?php foreach ($listRows as $record): ?>
<?php
if (@$lastSemester == $record['category_name']) { continue; } // skip this one
$lastSemester = $record['category_name']; // keep track of last seen semester
?>
<option value="coursesList.php?category=<?php echo $record['category_name'] ?>"> <?php echo $record['category_name'] ?> </option>
<?php endforeach ?>
</select>

I strayed a little from your code and set up a separate section edition for "Semesters." Next time, I'm going to try it using a list field in the article editor, your code and the right Dreamweaver code for jump menu.

This is a win-win. My client is getting a cool site, she's loving how easy it is to enter content, I'm loving how much I can customize it PLUS I think I'm learning a little PHP.

The page isn't perfect yet - I'm still tweaking but here it is: http://www.uga.edu/dev/ecology/coursesList.php?category=Fall%202008

Thanks again!
Jan

Re: [Janet] Drop down menu

By Dave - July 18, 2008

Janet,

Looks great! Thanks for posting back and sharing the url with us! :)
Dave Edis - Senior Developer

interactivetools.com

Re: [Janet] Drop down menu

By Donna - July 18, 2008

Little known fact: Dave is actually a robot we keep chained to his desk...

;)
Donna

--
support@interactivetools.com

Re: [Donna] Drop down menu

By Janet - July 18, 2008

That not little known - everyone out here building sites using your software think you all live at your desks. You guys offer the best support on the planet.

Re: [Janet] Drop down menu

By gkornbluth - July 20, 2008

I concur about the support...

And your site does look really good.

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php