Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-19-2008, 01:40 PM
Junior Member
 
Join Date: Mar 2008
Posts: 7
Default dynamic menu with html

Hello,

I'm using Yui-Menu to create a dynamic menu.
Therefor I'm using a function to create html code
PHP Code:
public function makeMenu()
    {
        
$notes $this->menuContent;
        
        
$firstNote true;
        
        
// begin HTML-tages
        
$htmlMenu '<div class="bd">' "\n" 
                        
'<ul class="first-of-type">' "\n";
        
        
        foreach (
$notes as $note)
        {
            if (
$firstNote) {
                
$htmlMenu .= '<li class="yuimenubaritem first-of-type">';
                
$firstNote false;
            } 
            else
                
$htmlMenu .= '<li class="yuimenubaritem">';
            
            
$htmlMenu .= '<a class="yuimenubaritemlabel" href="' $this->makeLink($note->ID) . '">' 
                      
$note->link_naam '</a>';
            
            
$children $note->getChildren();
            if (
$children->count() > 0)
                
$htmlMenu .= "\n" $this->makeSubMenu(strtolower($note->link_naam) ,$children);
            
            
// tag afsluiten
            
$htmlMenu .= '</li>' "\n";
        }
        
        
// resterende tags afsluiten
        
$htmlMenu .= '</ul>' "\n" '</div>' "\n";
        
        return 
$htmlMenu;
    } 
PHP Code:
    protected function makeSubMenu($htmlID$notes)
    {
        
$firstNote true;
        
        
// begin HTML-tags
        
$htmlSubMenu '<div id="' $htmlID '" class="yuimenu">' "\n" .
                               
'<div class="bd">' "\n" .
                                
'<ul>';
        
        foreach (
$notes as $note)
        {
            if (
$firstNote) {
                
$htmlSubMenu .= '<li class="yuimenuitem first-of-type">';
                
$firstNote false;
            } 
            else
                
$htmlSubMenu .= '<li class="yuimenuitem">';
            
            
$htmlSubMenu .= '<a class="yuimenubaritemlabel" href="' $this->makeLink($note->ID) . '">' 
                         
$note->link_naam '</a>';
            
            
$children $note->getChildren();
            if (
$children->count() > 0)
                
$htmlSubMenu .= $this->makeSubMenu($note->ID ,$children);
            
            
// LI-tag afsluiten
            
$htmlSubMenu .= '</li>' "\n";
        }
        
        
// resterende tags afsluiten
        
$htmlSubMenu .= '</ul>' .  "\n" .'</div>' .  "\n" .'</div>';
        
        return 
$htmlSubMenu;
    } 
Now, I would like to make the same but with a .phtml file because my url isn't corretly displayed on my Linux server.
Someone who knows how to do that?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 05:03 AM.