What I want is, that the menu item you've clicked should be marked as active (the light grey color) and for now it works with the pages Profil, Referencer and Kontakt, but not the front page.
... and the 'Forside' link is hardcoded at the moment.
Is there a better way to do this? It seems quite hard for me to make the 'Forside' page a part of this for-each loop as it is the parent node of the collection i'm looping through.
Any suggestions on this one? Or should I be re-structuring my site completely in order to make this? I'm still learning umbraco as I've made a change from PHP (Joomla!) to Umbraco.
Thanks for the answer! -and nice site you've got there :) That is exactly what I need for my menu.
I tried refactoring my structure, so now it's like this:
- Content
- Forside
- Profil
- Referencer
- Kontakt
So, now all the pages are on the same level (which I guess is level 1?) I tried to use the exact same xslt code that you're using, but sadly my menu has disappeared. Of course, I've changed it to use my active-link style instead ;)
I'll keep toying around with it though! It's good fun and a time-stealer.
Just as a side question really: how do you go about forwarding to your 'forside.aspx' when you enter www.fairlux.dk? I'd know exactly how if it were joomla, but it seems that the learning-curve in umbraco is a tad more steep than what I'm used to. Doesn't matter though, it's a great challenge :)
Got it to work now by doing as you wrote (need to read what people actually write ;))
The structure is now:
- Content
- Site name
- Forside
- Profil
- Referencer
- Kontakt
Only thing I'm not sure about now is, how I'm able to tell umbraco that when people are entering: www.thesite.com - it needs to automatically go to www.thesite.com/frontpage.aspx (else the menu won't display because there's no node)
Anyone know how to do this? I bet it's very, very simple ;) Just can't find it..
Found the solution to this thanks to a few minutes with google ;)
I added a property to the document type for what would be the "Site name" page in my last post. The property type alias should be called umbracoRedirect and the type should be a content picker. Then you're able to pick the page ('Forside' in my case) that should be redirected to. Pretty neat!
Just in case anyone with the same problem steps by this thread.
xslt menu problems
Hi fellow umbraco users,
I'm currently building a website based on umbraco and I ran into some problems with my main navigation.
My current structure is something like:
So as you can see, the Profile, References and Contact pages are children of the Frontpage - all pages are using the same document type.
You can see the site here: http://www.nuanceweb.dk
What I want is, that the menu item you've clicked should be marked as active (the light grey color) and for now it works with the pages Profil, Referencer and Kontakt, but not the front page.
My XSLT looks like this:
<xsl:for-each select="$currentPage/ancestor-or-self::node [@level=1]/node">
<a href="{umbraco.library:NiceUrl(@id)}">
<li class="menuItem">
<xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id">
<xsl:attribute name="class">activeMenuItem</xsl:attribute>
</xsl:if>
<div style="padding-top:7px;">
<xsl:value-of select="@nodeName" />
</div>
</li>
</a>
</xsl:for-each>
... and the 'Forside' link is hardcoded at the moment.
Is there a better way to do this? It seems quite hard for me to make the 'Forside' page a part of this for-each loop as it is the parent node of the collection i'm looping through.
Any suggestions on this one? Or should I be re-structuring my site completely in order to make this? I'm still learning umbraco as I've made a change from PHP (Joomla!) to Umbraco.
Thanks a lot in advance!
/ Bo
Hi Bo
I suggest that you build your site like this:
- Site name
- Forside
- Page number 2
- Page number 3
etc.. thus keeping your frontpage link on the same level as your subpages and thus cutting out a level.
I use this XSLT to do the same you're trying to acomplish:
Take a look at www.fairlux.dk - there i think i do what you're looking for with the above structure
Hey Martin,
Thanks for the answer! -and nice site you've got there :) That is exactly what I need for my menu.
I tried refactoring my structure, so now it's like this:
So, now all the pages are on the same level (which I guess is level 1?) I tried to use the exact same xslt code that you're using, but sadly my menu has disappeared. Of course, I've changed it to use my active-link style instead ;)
I'll keep toying around with it though! It's good fun and a time-stealer.
Just as a side question really: how do you go about forwarding to your 'forside.aspx' when you enter www.fairlux.dk? I'd know exactly how if it were joomla, but it seems that the learning-curve in umbraco is a tad more steep than what I'm used to. Doesn't matter though, it's a great challenge :)
Thanks again,
Bo
Got it to work now by doing as you wrote (need to read what people actually write ;))
The structure is now:
Only thing I'm not sure about now is, how I'm able to tell umbraco that when people are entering: www.thesite.com - it needs to automatically go to www.thesite.com/frontpage.aspx (else the menu won't display because there's no node)
Anyone know how to do this? I bet it's very, very simple ;) Just can't find it..
Found the solution to this thanks to a few minutes with google ;)
I added a property to the document type for what would be the "Site name" page in my last post. The property type alias should be called umbracoRedirect and the type should be a content picker. Then you're able to pick the page ('Forside' in my case) that should be redirected to. Pretty neat!
Just in case anyone with the same problem steps by this thread.
Hi Bo
Glad you got it working :-), but actually my Fairlux structure is like this:
- Fairlux.dk
- Forside
- Næste menupunkt
- etc
It might be a level setting in the xslt that makes your menu disappear. Se:
You tell the page to redirect to the "frontpage.aspx" by adding the umbracoRedirect property to your templates. See this reference:
http://our.umbraco.org/wiki/reference/umbraco-best-practices/umbracoredirect
Don't mind the warning described in the text and your set to go! :-)
Ok, you found it in the meantime. Good :-)
Ok... big DOH here,
Ofcourse my menu is like:
- Content
- Site name
- Subpage name
Glad you figured that out, my bad :-)
All good! ;) Figured out what you mean't anyway hehe.
Thanks a lot for your help! It's greatly appreciated :)
Mvh. Bo
is working on a reply...