 |

sagentic
User

Jun 2, 2008, 6:27 PM
Post #1 of 3
(248 views)
Shortcut
|
|
Expandable Categories
|
Can't Post
|
|
I am trying to use an Accordion Menu Script (http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu.htm) So far, I am getting shaky results. I have: <?php $lastCategory = ""; foreach ($hpmenuRecords as $hpmenuRecord): $showHeader = false; if ($hpmenuRecord['category'] != $lastCategory) { $lastCategory = $hpmenuRecord['category']; $showHeader = true; } ?> <?php if ($showHeader): ?> <h3 class="menuheader expandable"><?php echo $hpmenuRecord['category'] ?></h3> <ul class="categoryitems"><?php endif ?> <li><a href="<?php echo $hpmenuRecord['link'] ?>"><?php echo $hpmenuRecord['title'] ?></a></li> </ul> <?php endforeach; ?> It is not showing up right. The page I am working on is: http://www.cleburnehighschool.com/index.php A non-CMS Builder page where it works "out of the box" is: http://www.cleburnehighschool.com/index2.html
|
|
|  |
 |

Dave
Staff
/ Moderator

Jun 2, 2008, 9:31 PM
Post #2 of 3
(234 views)
Shortcut
|
|
Re: [sagentic] Expandable Categories
[In reply to]
|
Can't Post
|
|
Hi sagentic, It's adding a closing </ul> after each item. We need it to add that only once after each list of items but before the next header starts. Try adding the code in red:
<?php $lastCategory = ""; foreach ($hpmenuRecords as $hpmenuRecord): $showHeader = false; if ($hpmenuRecord['category'] != $lastCategory) { $lastCategory = $hpmenuRecord['category']; $showHeader = true; } ?> <?php if ($showHeader): ?> <?php if ($lastCategory): ?></ul><?php endif; ?> <h3 class="menuheader expandable"><?php echo $hpmenuRecord['category'] ?></h3> <ul class="categoryitems"> <?php endif ?> <li><a href="<?php echo $hpmenuRecord['link'] ?>"><?php echo $hpmenuRecord['title'] ?></a></li>
</ul> <?php endforeach; ?> </ul>
Let me know if that fixes it. Dave Edis - Senior Developer interactivetools.com
|
|
|  |
 |

sagentic
User

Jun 3, 2008, 9:04 AM
Post #3 of 3
(155 views)
Shortcut
|
|
Re: [Dave] Expandable Categories
[In reply to]
|
Can't Post
|
|
That did it! THANKS!
|
|
|  |
|