Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tonya Donahue 3 posts 23 karma points
    Sep 27, 2011 @ 18:35
    Tonya Donahue
    0

    Create Child pages

    I know I have to be overlooking the obvious...  I am trying to create a hierarchy of parent & child pages, along with a dropdown navigation, but don't know where to select a page to make it a child page.  This is my first time using Umbraco and am loving the possibilities. After working with CMS's and a variety of projects I can't believe this little thing is stumping me!

    Thanks

    Tonya

  • Tom Hare 49 posts 81 karma points
    Sep 27, 2011 @ 18:42
    Tom Hare
    0

    Hi Tonya,

    The golden rule with Umbraco is "right-click > Create" :)

    To create a child page, right-click on the parent, click 'Create' and go ahead selecting your document type etc (remember to set the allowed child document types in the 'Structure' tab).

    I'd highly recommend having a look at some of the video on http://umbraco.tv if you're just starting out.

    Below is the XSLT for a menu I've used recently, it'll show the main pages across the top and one level of subpages below.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:ucomponents.cms="urn:ucomponents.cms" xmlns:ucomponents.dates="urn:ucomponents.dates" xmlns:ucomponents.io="urn:ucomponents.io" xmlns:ucomponents.media="urn:ucomponents.media" xmlns:ucomponents.members="urn:ucomponents.members" xmlns:ucomponents.nodes="urn:ucomponents.nodes" xmlns:ucomponents.search="urn:ucomponents.search" xmlns:ucomponents.strings="urn:ucomponents.strings" xmlns:ucomponents.urls="urn:ucomponents.urls" xmlns:ucomponents.xml="urn:ucomponents.xml"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ucomponents.cms ucomponents.dates ucomponents.io ucomponents.media ucomponents.members ucomponents.nodes ucomponents.search ucomponents.strings ucomponents.urls ucomponents.xml ">

    <xsl:output method="xml" omit-xml-declaration="yes" />

    <xsl:param name="currentPage" />

    <!-- update this variable on how deep your site map should be -->
    <xsl:variable name="maxLevelForMenu" select="3" />

    <xsl:template match="/">
      <xsl:call-template name="drawNodes">
        <xsl:with-param name="parent" select="$currentPage/ancestor-or-self::* [@isDoc and @level=1]"/>
      </xsl:call-template>
    </xsl:template>

    <xsl:template name="drawNodes">
      <xsl:param name="parent" />
      <xsl:if test="umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)">
        <ul>
        <xsl:for-each select="$parent/* [@isDoc and string(umbracoNaviHide) != '1' and @level &lt;= $maxLevelForMenu]">
          <li>
            <xsl:if test="$currentPage/@id=@id">
              <xsl:attribute name="class">on</xsl:attribute>
            </xsl:if>
            <a href="{umbraco.library:NiceUrl(@id)}">
              <xsl:value-of select="@nodeName"/>
            </a>
            <xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1' and @level &lt;= $maxLevelForMenu]) &gt; 0">
              <xsl:call-template name="drawNodes">
                <xsl:with-param name="parent" select="." />
              </xsl:call-template>
            </xsl:if>
          </li>
        </xsl:for-each>
        </ul>
      </xsl:if>
    </xsl:template>
    </xsl:stylesheet>

    Happy Umbraco-ing!

  • Tonya Donahue 3 posts 23 karma points
    Sep 27, 2011 @ 18:47
    Tonya Donahue
    0

    I knew it had to be easy... thanks :-) 

    I've watched several of the videos and they have been a great help!

     

    Tks!

  • Tonya Donahue 3 posts 23 karma points
    Sep 27, 2011 @ 22:13
    Tonya Donahue
    0

    I do have one more question.  I started using a different XSLT for the menu, but went with yours for simplicity's sake.  My 'Home" link dropped off the menu... any ideas on why?  Do I need to add a link to test if home?

  • Tom Hare 49 posts 81 karma points
    Sep 28, 2011 @ 11:51
    Tom Hare
    0

    The reason that it's not showing is because it checks for the @level on line 19. In theory, you could change this from 1 to 0 but this isn't particularly desirable if you want to have 'hidden' auxiliary content at the same level as home plus it breaks the XSLT anyway. One way round this would be to add the following to line 27, after the <ul> and before the <xsl:for-each>.

    <xsl:if test="$parent/@level &lt; 2">
        <li><a href="/">Home</a></li>
    </xsl:if>

    Just adding the <li> there would put a link on any dropdowns as well because of the looping nature of the XSLT. The if statement effectively checks that the @level is no greater than 1, meaning it will add the link alongside top level pages only.

    Hope this helps.

Please Sign in or register to post replies

Write your reply to:

Draft