Subnavi only for first textpage

Apr 18, 2009 at 9:56 PM
Hi there,
first of all, thanks for this great starter kit!
I created several textpages under the root node; some of them with subpages.
Whenever I click on a textpage, the subitems of the first textpage with subpages are shown;
the subnavi always shows the header of the first textpage in the navigation tree.
Is it possible to have more than one textpage with subpages?

Regards

Matthias
Coordinator
Apr 20, 2009 at 8:27 AM
Hi Matthias,
Thanks for the feedback i'm glad you like it. I would appreciate if you would leave a review on the codeplex project page please if you have the time.

I am sorry i dont fully understand your question could you take some screenshots of your content tree in umbraco with some more explaination of what you are trying to achieve so I can help you out with this problem.

Many Thanks,
Warren
Apr 20, 2009 at 10:32 AM
Look at http://new.dcmohg.de
It is a clean install of umbraco 4.0.1 and CWS 2.0.1.
I have added two Textpages, Textpage1 and Textpage2. Each has two subpages; Textpage1_1, Textpage1_2 and so on.
When you click on Textpage1, the subnavigation below the main navigation shows

About

  • About Umbraco
  • About this project
  • Textpage1_1
  • Textpage1_2
  • Textpage2_2
  • Textpage2_1
I expected the subnavigation to show only the subpages of the current selected page; so if i click on "About" it should show

About

  • About Umbraco
  • About this project
When i click on Textpage1, it should show

Textpage1

  • Textpage1_1
  • Textpage1_2
Meanwhile I found http://umbracocws.codeplex.com/WorkItem/View.aspx?WorkItemId=2665 where the same problem is described. Is there any solution for this?

Regards

Matthias
Coordinator
Apr 20, 2009 at 1:57 PM
OK Matthias,
This seems to be an XSLT bug. I will do some testing later on and give you a fix when it is ready.

I recommend you vote for the bug/issue so to ensure i get it fixed for V2.0.2

Warren
Coordinator
Apr 20, 2009 at 4:26 PM
Hi Matthias,
I have fixed this http://umbracocws.codeplex.com/WorkItem/View.aspx?WorkItemId=2665 and you can see the resolution.

Warren
Apr 20, 2009 at 10:06 PM
Warren,
thank you very much for your help! Great work.
Apr 29, 2009 at 2:01 PM
Applying that fix still doesnt make it work for me :-(
Coordinator
Apr 29, 2009 at 2:05 PM
Can you copy and paste the XSLT here please and let me know of your content structure please.

Thanks,
Warren
Apr 29, 2009 at 2:08 PM
Edited Apr 29, 2009 at 2:12 PM
Here's the current XSLT:

[code]
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]><xsl:stylesheetversion="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:msxml="urn:schemas-microsoft-com:xslt"xmlns:umbraco.library="urn:umbraco.library"exclude-result-prefixes="msxml umbraco.library"><xsl:output method="xml" omit-xml-declaration="yes"/><xsl:param name="currentPage"/><xsl:template match="/"><xsl:variable name="rootTextpageNode" select="$currentPage/ancestor-or-self::node [@level = 2 and @nodeTypeAlias = 'CWS_Textpage']" /><div class="secondaryNav"><h3><xsl:value-of select="$rootTextpageNode/@nodeName"/></h3><ul><xsl:for-each select="$rootTextpageNode/node"><li><xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id"><xsl:attribute name="class"><xsl:text>selected</xsl:text></xsl:attribute></xsl:if><a href="{umbraco.library:NiceUrl(current()/@id)}"><span><xsl:value-of select="current()/@nodeName"/></span></a></li></xsl:for-each></ul></div></xsl:template></xsl:stylesheet>
[/code]

Can someone plz explain how you can add code without having codeplex mess up the layout??!
Coordinator
Apr 29, 2009 at 2:14 PM
I am not sure you just need to copy and paste the code nto wrap [code] around it.

What is your content structure please?

eg

home
---> About
---->----->Some page below about

etc....

Warren
Apr 29, 2009 at 2:18 PM
Currently its

Home
--> about
-->-->History
-->-->Positions
-->News
-->-->newsitem1
-->Contant
-->SendPage
-->Products
-->-->Prod1
-->-->Prod2
Coordinator
Apr 29, 2009 at 2:25 PM
OK on what page is the subnavi a problem?!

Warren
Apr 29, 2009 at 6:11 PM
Its on the "Products" page... I expect prod1 and prod2 to be listed in SubNavi, but instead its empty... 
Apr 30, 2009 at 7:58 AM
Using the XSLT Visualizer, if I choose "About" the h3 and li-items gets generated, but if I choose "Products" the only html that gets generated is:
<div class="secondaryNav"><h3></h3><ul></ul></div>
Apr 30, 2009 at 8:09 AM
Solved this by changing the line to
<xsl:variable name="rootTextpageNode" select="$currentPage/ancestor-or-self::node [@level = 2]" />

Maybe I have messed up the document type, but I couldn't find any reference to CWS_TextPage. Besides, that test probably isn't needed. What this XSLT so far is missing (afaik) is a test for the "Hide from Nav" checkbox is selected.
Coordinator
Apr 30, 2009 at 8:22 AM
Glad you have figured it out, this is what CWS2 will help you to do get involved with your XSLT and start to understand what is going on.

It looks like your new Products page was not a CWS_Textpage document type hence it did not find it.

If you want help with the hide let me know, but i think it would be good practise to see if you can figure it out yourself to see if you can learn umbraco & XSLT.

Warren
Apr 30, 2009 at 8:27 AM
Hehe... I had that comming, didn't I? ;-)

Yea, I saw the test was in place in Navi.xslt, so I guess I'll figure it out.

Thanks for the CWS, it really got me going with Umbraco, without having to pay for umbraco.tv ;-)
Coordinator
Apr 30, 2009 at 8:36 AM
Glad you found CWS to be a big help for you to learn Umbraco.

If you like CWS I recommend you suggest Umbraco and CWS to all your friends/collegues and if you have the time I would appreciate if you can leave a review for CWS here please
http://umbracocws.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=26494

Thanks,
Warren


May 3, 2009 at 2:40 AM
skaue,

I have the same problem as you were having. However, I am not nearly as technically skilled as you.
Sometimes I can learn the "rules" of how a site or page is put together by looking at the code, but this
is beyond me. Can you please explain to me exactly where that line of code goes? I am not finding the
line of code that you showed in your April 29, 10:08 AM post. Is the code located in the template of
the document type where the SubNavi is not showing? Do I have to replace another line of code or
insert the line that you provided into the "sidebar" section? Right now, the only line of code in that
section is:
<umbraco:Macro Alias="CWS_SubNavi" runat="server"></umbraco:Macro>

Sorry for the newbie question. Thanks in advance for any assistance.

Diffie
(Extreme Newbie)
May 3, 2009 at 2:51 AM
ok, I think I found it - in the Developer section under "XSLT Files" -> "SubNavi.xslt"

If this is not correct, please let me know.

Regards,
Diffie
May 4, 2009 at 7:24 AM
Hi Diffie.

No need to appologize. We're all learning here :-)

Yes, you'll have to edit the SubNavi.xslt located under Developer section and XSLT-Files. I simply changed

[@level = 2 and @nodeTypeAlias = 'CWS_Textpage']

to

[@level = 2]

Good luck, and don't be afraid to ask.