Topic: text on menu

i need to implement menu

<ul id="navigation" class="grid_8">
            <li><a href="contact.html"><span class="meta">Get in touch</span><br />Contact Us</a></li>
            <li><a href="blog.html"><span class="meta">Latest news</span><br />Blog</a></li>
            <li><a href="portfolio.html"><span class="meta">Our latest work</span><br />Portfolio</a></li>
                
            <li><a href="about.html"><span class="meta">Who are we?</span><br />About</a></li>
            <li><a href="index.html" class="current"><span class="meta">Homepage</span><br />Home</a></li>
        </ul>

from this

<ul id="navigation" class="grid_8">        
<?php foreach($this->find('/')->children() as $menu): ?>
      <li><?php echo $menu->link($menu->title, (in_array($menu->slug, explode('/', $this->url)) ? ' class="current"': null)); ?></li>
<?php endforeach; ?> 
<li><a<?php echo url_match('/') ? ' class="current"': ''; ?> href="<?php echo URL_PUBLIC; ?>">דף הבית</a></li>
</ul> 

how i enter a text like this "<span class="meta">Get in touch</span><br />Contact Us"

Last edited by bermaneyal (2010-07-29 22:29)

Re: text on menu

Would this help?:

<ul id="navigation" class="grid_8">        
<?php foreach($this->find('/')->children() as $menu): ?>
<li><?php echo $menu->link($menu->title, (in_array($menu->slug, explode('/', $this->url)) ? ' class="current"': null)); ?></li>
<?php endforeach; ?> 
<li><a<?php echo url_match('/') ? ' class="current"': ''; ?> href="<?php echo URL_PUBLIC; ?>">
<span class="meta">Get in touch</span><br />דף הבית</a></li>
</ul> 

Unless you need the span content to be dynamic, then do something like this:

<ul id="navigation" class="grid_8">        
<?php foreach($this->find('/')->children() as $menu): ?>
<li><?php echo $menu->link($menu->title, (in_array($menu->slug, explode('/', $this->url)) ? ' class="current"': null)); ?></li>
<?php endforeach; ?> 

<?php foreach($menu->tags() as $tag):
return $span;
endforeach; ?>

<li><a<?php echo url_match('/') ? ' class="current"': ''; ?> href="<?php echo URL_PUBLIC; ?>">
<span class="meta"><?php echo $span ?></span><br />דף הבית</a></li>
</ul>

Last edited by Fortron (2010-07-29 23:53)

Re: text on menu

Fortron wrote:

Would this help?:

<ul id="navigation" class="grid_8">        
<?php foreach($this->find('/')->children() as $menu): ?>
<li><?php echo $menu->link($menu->title, (in_array($menu->slug, explode('/', $this->url)) ? ' class="current"': null)); ?></li>
<?php endforeach; ?> 
<li><a<?php echo url_match('/') ? ' class="current"': ''; ?> href="<?php echo URL_PUBLIC; ?>">
<span class="meta">Get in touch</span><br />דף הבית</a></li>
</ul> 

Unless you need the span content to be dynamic, then do something like this:

<ul id="navigation" class="grid_8">        
<?php foreach($this->find('/')->children() as $menu): ?>
<li><?php echo $menu->link($menu->title, (in_array($menu->slug, explode('/', $this->url)) ? ' class="current"': null)); ?></li>
<?php endforeach; ?> 

<?php foreach($menu->tags() as $tag):
return $span;
endforeach; ?>

<li><a<?php echo url_match('/') ? ' class="current"': ''; ?> href="<?php echo URL_PUBLIC; ?>">
<span class="meta"><?php echo $span ?></span><br />דף הבית</a></li>
</ul>

every menu item need to have a dynamic text from the db,
<span class="meta"> text from tab slogen </span><br />name of page

Re: text on menu

I think is better to leave the tags field for its original purpose, this solution would require you to create a page_part in this case called "subtitle" where you would put what you wanted.
Though in case it doesn't exists it outputs just the page title.

<ul id="navigation" class="grid_8">        
<?php foreach($this->find('/')->children() as $menu): ?>
<li><?php echo $menu->link( $menu->content('subtitle') ? '<span class="meta">'.$menu->content('subtitle').'</span><br />'.$menu->title: "$menu->title"
, (in_array( $menu->slug, explode('/', $this->url)) ? 'class="current"': null)); ?></li>
<?php endforeach; ?> 
<li><a<?php echo url_match('/') ? ' class="current"': ''; ?> href="<?php echo URL_PUBLIC; ?>">
</ul>

Thumbs up