Top and Left not related menus Options
robfum
Posted: Monday, August 25, 2008 11:46:51 PM
Rank: Newbie

Joined: 7/12/2008
Posts: 13
Location: Italy
I have these contents:

Item 1
-Child 1
-Child 2
.......
-Child n
Item 2
Item 3
.....
Item n

Item 1 and his childnodes goes in the Topmenu while Item2...item n are for the left menu.
I need an <xsl:for-each select=""> to list Item 1 and his childnodes for the Top menu, and another one to list all top level nodes except the first one (Item 1) for the left menu.

Is this possible?

Thanx!

Rob
Dirk
Posted: Tuesday, August 26, 2008 8:29:42 AM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,136
Location: Belgium
Hi Rob,

Shouldn't be too difficult. I would create a single xslt's that can handle both navigations.

As to know which nodes go into the xslt for-each statement, create an extra property on the document type (or document types for 'Item 1', 'Child 1', ...) 'Show in Top Navigation' (Alias="ShowInTopNavigation") and check the xslt to include/exclude nodes based on that value (Just as you would use the 'umbracoNaviHide' which you can find in almost any navigation xslt)

Add a parameter to your macro, 'TopNavigation' of type 'True/False'.
Get the value for the parameter in your xslt, and decide based on the value, which nodes to use

Code:
<xsl:param name="TopNavigation" select="/macro/TopNavigation" />


Code:
<xsl:for-each select="$currentPage/node [string(data [@alias='TopNavigation']) = $TopNavigation]">


Did I make myself clear? If not, shoot more questions.

Regards,
/Dirk




level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
robfum
Posted: Tuesday, August 26, 2008 6:24:31 PM
Rank: Newbie

Joined: 7/12/2008
Posts: 13
Location: Italy
Thank you Dirk,

I will try your suggest approach, but just for my knowledge I would like to know if this is the only solution because in this site I have only a few pages and only 4 pages goes on the top Menu, thus it is not a problem set this flag in each page but in another site that I would like to create with Umbraco, I have about 6.000 pages and my idea is to create two branch at the top level in the content tree and to use one branch for the top menu and the other one for the left menu.

Many Thanx,

Rob

robfum
Posted: Wednesday, August 27, 2008 4:00:37 PM
Rank: Newbie

Joined: 7/12/2008
Posts: 13
Location: Italy
Hello Dirk,

I'm still not able to list top level content. This is my content structure:



I'm only able to have the child nodes of the welcome page listed, but I'm bot able to list all the top.

What is the right <xsl:for-each select=""> sintax to list all the top level nodes of the Content tree?

Many thanx!

Rob

Dirk
Posted: Wednesday, August 27, 2008 4:17:02 PM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,136
Location: Belgium
Hey Rob,

In order to get all top level nodes in the content tree, use

Code:
<xsl:for-each select="$currentPage/ancestor::root/node [...]">
  ...
</xsl:for-each>


Greetz,
/Dirk


level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
robfum
Posted: Thursday, August 28, 2008 4:46:58 PM
Rank: Newbie

Joined: 7/12/2008
Posts: 13
Location: Italy
Thank you Dirk,

it works!

bootnumlock
Posted: Thursday, August 28, 2008 4:49:08 PM

Rank: Fanatic

Joined: 10/9/2006
Posts: 460
Location: batavia, IL
Just for the record... Dirk is leading the way for an MVP 09 award in my opinion!

Thanks for all you do in the community Dirk!

bootnumlock - aka bob baty-barr
My Packages Site: http://packages.maliciousthinktank.com
Business Blog: http://www.maliciousthinktank.com/blog
Personal site: http://www.baty-barr.com
Level 1 Certified!
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.