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>
Inserting macros created from builtin "list subpages by level" and
"list subpages by document type" returns no content. I must be missing something major.
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.
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.
"$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.
<!-- 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>
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:
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 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)
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?
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")
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>
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.
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.
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.
One part resolved, got the "List pages by level" to work bu changing the level indicated in the xslt.
Hi Teena,
Try something like this
Best of luck
Rich
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.
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:
"$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
This works for us (Umbraco 4.5.2)
I keep forgetting to ask which version & schema people are running.
Which Umbraco version are you running Teena?
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:
Here's the footer 'view source' code (UNDERWRITERS and PRODUCTS/SERVICES are still hardcoded):
Thanks in adavnce for your thoughts.
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
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.
* Company Overview
* Partnership Approach
* Implementation Methodology
* Development Lifecycle
* User Group
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.
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
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)
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?
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
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.
Not tested but try this
Rich
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.
is working on a reply...