Dave, horizontal menu please

chiste
chiste's picture

Joined: 2008-05-15
Posts: 12
Posted: Tue, 2008-06-03 05:18

I'm creating a custom theme with an horizontal navitagion to the main albums. To acompish this I have tried to different approches, but none works

Fisrt I tried an unsorted list of the theme children:

<ul id="navigation" class="navigation" >
    {foreach from=$theme.children item=child}
        {capture assign=linkUrl}{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}{/capture}
        <li><a href="{$linkUrl}" >
            {if !empty($child.title)}
               {$child.title|markup}
            {/if}
        </a></li>
    {/foreach}
</ul>

Next I tried a Peer List Block

<div id="navigation"  class="navigation" >
	{g->block type="core.PeerList"}
</div>

The problem is that in both casses, the naviation items change as the user goes deep into the sub items the album.

More information on my previous post
http://gallery.menalto.com/node/77674

Here is an image of my theme
[img]http://img219.imageshack.us/img219/6571/picture1dy5.png[/img]

CHEFS, RESTAURANTES, PLATOS, INSUMOS and REPORTAJES are the main album names and I want my navigation bar to keap those links permantly. Please help.

Look at my site at
http://photosgourmetperu.com/gallery2/

Chiste

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2008-06-03 06:04

So you only want to show the root albums only?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
chiste
chiste's picture

Joined: 2008-05-15
Posts: 12
Posted: Tue, 2008-06-03 06:08

Yes, please. I dont what to hard-code them in case I change or ad one

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2008-06-04 03:42

You will need to have the album select module activated but not necessarily used

	{g->callback type="albumselect.LoadAlbumData"
	     stripTitles=true truncateTitles="20" createTextTree=true}
	{assign var="data" value=$block.albumselect.LoadAlbumData.albumSelect}
	<ul id="nav">
	<ul>	
	{foreach from=$data.tree item=node}
	{if $node.depth == 0}
		<li>
		<a href="{$data.links.prefix}{$data.links[$node.id]}">{$data.titles[$node.id]}</a>
		</li>
	{/if}
	{/foreach}
	</ul>

You will have to change the id of the unordered list and well as add a ID to the list item if needed for css

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
chiste
chiste's picture

Joined: 2008-05-15
Posts: 12
Posted: Wed, 2008-06-04 05:34

Thanks Dave, that was exactly what I was looking for. Maybe you can help with one more thing. I need to check a seccond condition to know the current album to add a css class

<ul id="navigation" class="navigation" >	
					{foreach from=$data.tree item=node}
						{if ($node.depth == 0) && ( SECOND CONDITION TO CHECK IF ITS THE CURRENT ALBUM)}
							<li>
								<a href="{$data.links.prefix}{$data.links[$node.id]}"  class="current" >{$data.titles[$node.id]}</a>
							</li>
						{elseif $node.depth == 0}
							<li>
								<a href="{$data.links.prefix}{$data.links[$node.id]}">{$data.titles[$node.id]}</a>
							</li>
						{/if}
					{/foreach}
				</ul>
 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2008-06-04 13:06

{if $theme.item.title == $data.titles[$node.id]}same{/if}

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
chiste
chiste's picture

Joined: 2008-05-15
Posts: 12
Posted: Fri, 2008-06-06 05:54

Thanks again Dave. It worked beautifully. How ever, when you click on an album image or subalbum, it no longer work. Obviously it its because the clicked item has a different title. Please take a look at my site to see what I'm taking about.

http://photosgourmetperu.com/gallery2/

This is how I implement your code

{g->callback type="albumselect.LoadAlbumData" stripTitles=true truncateTitles="20" createTextTree=true}
			{assign var="data" value=$block.albumselect.LoadAlbumData.albumSelect}
				<ul id="navigation" class="navigation" >	
					{foreach from=$data.tree item=node}
						{if ($node.depth == 0) && ($theme.item.title == $data.titles[$node.id])}
							<li>
								<a href="{$data.links.prefix}{$data.links[$node.id]}"  class="current" >{$data.titles[$node.id]}</a>
							</li>
						{elseif $node.depth == 0}
							<li>
								<a href="{$data.links.prefix}{$data.links[$node.id]}">{$data.titles[$node.id]}</a>
							</li>
						{/if}
					{/foreach}
				</ul>
 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2008-06-06 06:26

I guess you need to detect if you are on a photo page and then check the parent of the photo to see if it is the current.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
muffin9129

Joined: 2009-07-10
Posts: 1
Posted: Fri, 2009-07-10 21:46

Love the horizontal bar. it worked great for me, but seem to have the same problem as chiste. The titles are to blame, but would not have been able to do this without you so I am kind of stuck.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2009-07-10 22:48

I don't understand the issue. Is the title of the root album not a link? is it possibly to long and gets truncated?
The link you provided I don't see a gallery2 install.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Pat.R

Joined: 2009-07-21
Posts: 1
Posted: Tue, 2009-07-21 22:56

Thank-you for this. I like the horizontal bars much better thent he standard vertical ones. It makes it look more professional and different so thank-you.

Pat.R

 
chiste
chiste's picture

Joined: 2008-05-15
Posts: 12
Posted: Fri, 2009-07-31 15:00

Floridave

I'm affraid that this forum is being a victim of spam. Last 3 posts make no sense. Just look at "epilare" link. I recomend to implement some kind of captcha to post a new comment.

Chiste

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Fri, 2009-07-31 15:20

Christe,

We actually don't have that big of a problem with spam in the forums. When you see it you can click mark as spam, that will flag the message. Also, when we these messages, the moderators can also remove the post and block the users.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here