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?