Copied to clipboard

Flag this post as spam?

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


  • Teena 44 posts 64 karma points
    Sep 16, 2010 @ 06:56
    Teena
    0

    list pages in specific nodes for display in template footer

    Greetings!

    Working on implmenting a design that features footer links to pages separated by category:

    So I made pages in nodes

    Products-Services
        Complimentary
        Training
        etc

    Underwriters
        Products
        News
        etc

    In the master template, replaces the static list with a macro created from "list subpages from a changeable source" which resulted in variations of:
    <umbraco:Macro Source="1297" Alias="source" runat="server"></umbraco:Macro>

    Seems logical but doesn't work.

    Is there an easy fix or an easier way to do this?

    Thanks in advance.

  • Teena 44 posts 64 karma points
    Sep 16, 2010 @ 07:31
    Teena
    0

    More info: 

    Inserting macros created from builtin "list subpages by level" and  "list subpages by document type" returns no content.  I must be missing something major. 

  • Teena 44 posts 64 karma points
    Sep 16, 2010 @ 07:39
    Teena
    0

    One part resolved, got the "List pages by level" to work bu changing the level indicated in the xslt.

  • Rich Green 2246 posts 4008 karma points
    Sep 16, 2010 @ 07:39
    Rich Green
    0

    Hi Teena,

    Try something like this

    <xsl:for-each select="$currentPage/ancestor-or-self::node [@level=1]/node [string(data [@alias='umbracoNaviHide']) != '1']">
    
    <xsl:if test="./node/@id !=''">
        <h2><xsl:value-of select="@nodeName"/></h2> 
    
        <ul>
            <xsl:for-each select="./node [string(data [@alias='umbracoNaviHide']) != '1']">
                <li>
                    <a href="{umbraco.library:NiceUrl(@id)}">
                        <xsl:value-of select="@nodeName"/>
                    </a>
                </li> 
            </xsl:for-each>
        </ul>
    </xsl:if>
    </xsl:for-each>

    Best of luck

    Rich

  • Teena 44 posts 64 karma points
    Sep 16, 2010 @ 09:34
    Teena
    0

    Hey Rich, Thanks for the input.  So... is that for making a list of links under a particular node?  If so, where to I chage it to indicate which node?  I'm struggeling to get away from the $currentPage concept because these lists are template footer items that appear on all pages.  I have them hard coded in the master template and that's where I am trying to insert the macro.   I am planning 5 seperate macros in the footer, one for each node.

    So I entered this code into a .xlst checking the box "create macro", then insereted the macro into the footer area of the master template with no visible result. 

    I am really green, I'm watching videos but it's not quite clickin yet.

  • Rich Green 2246 posts 4008 karma points
    Sep 16, 2010 @ 09:56
    Rich Green
    0

    Hi Teena,

    The object here (I assume) is to show these links regardless of where you are in the site, you don't have to indicate which node you are on, this is what $currentPage does.

    Have a look at the following line:

    <xsl:for-each select="$currentPage/ancestor-or-self::node [@level=1]/node [string(data [@alias='umbracoNaviHide']) != '1']">

    "$currentPage/ancestor-or-self" bascially says  "get me any node on level 1 above the current page" (where the node is not hidden)

    This means that the level 1 nodes will be shown in the footer regardless of which page you're on (not always on multi-lingual sites but assume this is not the case here).

    Best to plug the XSLT in and see what it displays.

    Rich

  • Rik Helsen 670 posts 873 karma points
    Sep 16, 2010 @ 10:05
    Rik Helsen
    0

    This works for us (Umbraco 4.5.2)

    <?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"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">

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

    <xsl:param name="currentPage"/>

    <!-- Don't change this, but add a 'contentPicker' element to -->
    <!-- your macro with an alias named 'source' -->
    <xsl:variable name="source" select="/macro/source"/>

    <xsl:template match="/">

    <!-- The fun starts here -->
    <ul>
    <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']">
      <li>
        <a href="{umbraco.library:NiceUrl(@id)}">
          <xsl:if test="@id = $currentPage/@id"><xsl:attribute name="class">selected</xsl:attribute></xsl:if>

    <!--Text for the link - we have a long and a short title associated with all doctypes -->
    <xsl:choose>
    <xsl:when test="string(navTitle) = ''">
    <xsl:value-of select="title"/>
    </xsl:when>
    <xsl:otherwise>
    <xsl:value-of select="navTitle"/>
    </xsl:otherwise>
    </xsl:choose>

        </a>
      </li>
    </xsl:for-each>
    </ul>

    </xsl:template>

    </xsl:stylesheet>
  • Rich Green 2246 posts 4008 karma points
    Sep 16, 2010 @ 10:14
    Rich Green
    0

    I keep forgetting to ask which version & schema people are running.

    Which Umbraco version are you running Teena?

  • Teena 44 posts 64 karma points
    Sep 16, 2010 @ 15:33
    Teena
    0

    Rich,  it's umbraco v 4.0.4.2 (Assembly version: 1.0.3811.17115).  I did plug the XSLT into an XSLT named Footernav, then added the associated macro to the master template.  Nothing displayed.

    Hi Rik,  I placed your suggestion in an XSLT named FooterLinks2 with make macro clicked; then went to the macro and added a contentPicker with an alias of source; then went to the template and added three versions of it referencing 3 of the desired nodes.  Nothing displayed.

    I must be missing somehting basic.  Here's a detail of activities:

    • Both XLTS were entered exactly as given.
    • Here's a screen print of Rich's macro:

    • Here's a screen print of Rik's macro:

    • Here's the footer source from the master tempate with one one of Rich's macros and 3 of Ric's:

           
    <umbraco:Macro Alias="Footernav" runat="server"></umbraco:Macro>


    <div id="f-about" class="footer-mod">
    <umbraco:Macro source="1295" Alias="FooterLinks2" runat="server"></umbraco:Macro>
    </div>
    <div id="f-resources" class="footer-mod">
    <umbraco:Macro source="1296" Alias="FooterLinks2" runat="server"></umbraco:Macro>
    </div>
    <div id="f-support" class="footer-mod">
    <umbraco:Macro source="1297" Alias="FooterLinks2" runat="server"></umbraco:Macro>
    </div>
    <div id="copyright" class="footer-mod" style="font-weight:700; font-size: .80em; display:none;"> ©
    2010 RamQuest, Inc. </div>
    <div id="f-unerwriters" class="footer-mod" style="float:right;">
    <h3><a href="#">UNDERWRITERS </a></h3>
    <ul>
    <li><a href="#">Products/Services</a><br />
    <a href="#">News</a><br />
    <a href="#">Resources</a><br />
    </li>
    </ul>
    </div>
    <div id="f-products" class="footer-mod" style="float:right;">
    <h3><a href="#">PRODUCTS/SERVICES</a></h3>
    <ul>
    <li><a href="#">Complementary Products</a></li>
    <li><a href="#">Training</a></li>
    <li><a href="#"> RamQuest Rx</a> </li>
    </ul>
    </div>

    <!-- end .footer -->
    </div>

       

    • Here's what the footer looks like through a browser (the two lists on the right are still hard coded):

    Here's the footer 'view source' code (UNDERWRITERS and PRODUCTS/SERVICES are still hardcoded):

    <div class="footer">
    
    
    
    
    
    
    
    
    
    
        <div id="f-about" class="footer-mod">
    <ul />
        div>
        <div id="f-resources" class="footer-mod">
    <ul />
        div>
        <div id="f-support" class="footer-mod">
    <ul />
        div>
        <div id="copyright" class="footer-mod" style="font-weight:700; font-size: .80em; display:none;"> ©
          2010 RamQuest, Inc. div>
        <div id="f-unerwriters" class="footer-mod" style="float:right;">
          <h3><a href="#">UNDERWRITERS a>h3>
          <ul>
            <li><a href="#">Products/Servicesa><br />
                <a href="#">Newsa><br />
                <a href="#">Resourcesa><br />
            li>
          ul>
        div>
        <div id="f-products" class="footer-mod"  style="float:right;">
          <h3><a href="#">PRODUCTS/SERVICESa>h3>
          <ul>
            <li><a href="#">Complementary Productsa>li>
            <li><a href="#">Traininga>li>
            <li><a href="#"> RamQuest Rxa> li>
          ul>
        div>
    
        
      div>
    

     

    Thanks in adavnce for your thoughts.

     

  • Rich Green 2246 posts 4008 karma points
    Sep 16, 2010 @ 15:38
    Rich Green
    0

    Rics code is for the new XML schema (4.5) so won't be expected to work in your case.

    Set up a Site Map XSLT macro (the template is in the dropdown), ans see what your output is.

    Rich

  • Teena 44 posts 64 karma points
    Sep 16, 2010 @ 16:03
    Teena
    0

    I added a Sitemap XSLT utilizing the template in the dropdown with create macro checked; then checked use in RTE in the macro.  Then added the SiteMap to a page via the content editor.

    • Here's the output:

        * Company Overview
        * Partnership Approach
        * Implementation Methodology
        * Development Lifecycle
        * User Group

    • Here's a screen print of the content panel:

    Is it difficult to update to the new XML schema (4.5)? That explains why my original attempt did not work.   Is it the same as a Umbraco version update?  The server admin did the install so I have not read up on it.

  • Rich Green 2246 posts 4008 karma points
    Sep 16, 2010 @ 16:15
    Rich Green
    0

    Ok, 

    Basically, this is how most people (well I certainly do) set their sites up:

    Home

    -- The Total Solution

    -- For Current Clients

    -- About

     

    Where as you have:

    Home

    The Total Solution

    For Current Clients

    About

     

    Move "The total solution" under your home node (remember to give the home node permission to do this)

    This should point you in the right direction.

    Rich

     

  • Rik Helsen 670 posts 873 karma points
    Sep 16, 2010 @ 16:58
    Rik Helsen
    0

    Rich Green is right, you need a good site structure for navigation to work properly

    example (en is the homepage in my case, and www is a redirectscript that checks the browser language and redirects people to the site in their language)

  • Teena 44 posts 64 karma points
    Sep 16, 2010 @ 17:01
    Teena
    0

    Wow!  That was incredibly useful information.  I moved all nodes except members only under home and the macros lit up like the alien spacecraft in 'Independence Day'. 

    Rich's script now displays what looks like a site map, all nodes in the site are displayed in list order with titles.  As they are in list order, I can see formatting them via css to match the design I was given with much effort.  However, the list includes all nodes under home, not just the 5 we are after.  I could use css and display none on non-target nodes but that strategy would become problematic as the site grew.  There must be a more efficient solution to get only the target nodes.

    The changeable source option would perfect if it would work. 

    Is the umbraco v 4.0.4.2 version going to be an issue I keep running into?  Is it difficult to update to the new XML schema (4.5)?   Is it the same as a Umbraco version update?  The server admin did the install so I have not read up on it.  If it is not a big deal I could ask for the upgrade.  Is it worth it?

  • Rich Green 2246 posts 4008 karma points
    Sep 16, 2010 @ 17:06
    Rich Green
    0

    Hi Teena,

    Add a property to the doctype (the one that is the same type as "Products/Services") where you want to display them in the footer called "displayInFooter" make this a "True/False" property.

    Then check all the nodes you want (again "Products/Services" and "Underwriters") 

    Then use this XSLT

    <xsl:for-each select="$currentPage/ancestor-or-self::node [@level=1]/node [string(data [@alias='displayInFooter']) = '1']">
    
    <xsl:if test="./node/@id !=''">
            <h2><xsl:value-of select="@nodeName"/></h2> 
    
            <ul>
                    <xsl:for-each select="./node [string(data [@alias='umbracoNaviHide']) != '1']">
                            <li>
                                    <a href="{umbraco.library:NiceUrl(@id)}">
                                            <xsl:value-of select="@nodeName"/>
                                    </a>
                            </li> 
                    </xsl:for-each>
            </ul>
    </xsl:if>
    </xsl:for-each>

    Rich

  • Teena 44 posts 64 karma points
    Sep 16, 2010 @ 19:04
    Teena
    0

    Thanks Rich, that works great.  I changed the h2s to h3s in the xslt and now I need to add a unique class to each h3 so that I can apply the node specific widths and floats required by the design. 

    Something like (does not work but may convery my meaning): <h3 class="<xsl:value-of select="@nodeName"/>"><xsl:value-of select="@nodeName"/></h3>

    Any assistance deeply appreciated.

  • Rich Green 2246 posts 4008 karma points
    Sep 16, 2010 @ 19:13
    Rich Green
    0

    Not tested but try this

    <xsl:for-each select="$currentPage/ancestor-or-self::node [@level=1]/node [string(data [@alias='displayInFooter']) = '1']">
    
    <xsl:if test="./node/@id !=''">
            <h3><xsl:attribute name="class"><xsl:value-of select="@nodeName"/></xsl:attribute><xsl:value-of select="@nodeName"/></h3> 
    
            <ul>
                    <xsl:for-each select="./node [string(data [@alias='umbracoNaviHide']) != '1']">
                            <li>
                                    <a href="{umbraco.library:NiceUrl(@id)}">
                                            <xsl:value-of select="@nodeName"/>
                                    </a>
                            </li> 
                    </xsl:for-each>
            </ul>
    </xsl:if>
    </xsl:for-each>

    Rich

  • Teena 44 posts 64 karma points
    Sep 16, 2010 @ 21:10
    Teena
    0

    Thanks again.  It's finally starting to click.  I added a div with a mod style and used your method to get a dynamic id to render so my old css form the static lists work.  Fantastic.  Thanks to Rich and Rik for all your help.

Please Sign in or register to post replies

Write your reply to:

Draft