Now what I want to do is display "Related Links" preoperty in Umbraco into footer of All Templates. No matter if its HomePage or ContentPages I still want this to be displayed.
What I have done is:
I create a new tab in HomePage Document Type called "SitemapFooter".
Added a new Property as "sitemapFooterContent" and added the type as "Related Links".
I have added content on the Related Links which is on SitemapFooter tab of my Home Page template. HomePage template is only being used once so there is only one page called Home.aspx
Created a XSLT and AutoCreate Macro - Name it SitemapFooter and choose template as "Related Links".
On the XSLT file I have changed <xsl:variable name="propertyAlias" select="string('sitemapFooterContent')"/>
Added a Content Area Place holder on Master Template where the SitemapFooter needs to be naming it SitemapFooterPH
Added the SitemapFooterPH content area on HomePage template
Added the Macro SitemapFooter inside the SitemapFooterPH content area.
Now my issue is, this content (Related Links) results will show on anypage that has HomePage as their template. I want that Related Field to be shown on all template.
I have tried reading online, even had a look at the videos but cannot find any resource.
In short, what I want to do is:
1. To be able to edit "Related Links" field form some where 2. To be able to show the "Related Links" on all templates at the bottom (meaning adding it to master template)
Can some one guide me how do I do this, I am new to Umbraco so dont know too much.
I'm assuming you'll want different related links per page, so what I would suggest is to create a master document type which works similar to a master template, but for document types. With this, you can define your SiteMapFooter tab on your master doc type, then when you create a new doc type, you can set it's master doc type, to that doc type. This will then make the SiteMapFooter tab available on all doc types which use that master doc type (so you don't have to create it again on each new doc type).
Just create your master doc type as usual, and then to create your sub doc type, in the create dialog where you enter the name of your doc type, select your master doc type from the "Master" dropdown list.
Your sub doc type will now inherit all tabs and properties from your master doc type.
With any piece of functionality or design that you want to appear automatically on each page you need to put this functionality into a master template.
The idea is that the master template will always have the related links macro, this macro calls an XSLT file which knows which page the user is on by the use of a variable called '$currentPage', by using this variable you can get XSLT to show the related links for the page the user is visiting.
Try adding some text to your xslt file outside your logic to make sure that the macro is getting called, just something like "test text" this will tell you if your macro is being called.
If you see this text on every page then there's something wrong with your XSLT, if not then you've got something wrong with your set up.
Using Macro's on Multiple Pages - Please help
Hello there,
The structure I have on my templating is:
Master Template
There are also Document Types as:
Now what I want to do is display "Related Links" preoperty in Umbraco into footer of All Templates.
No matter if its HomePage or ContentPages I still want this to be displayed.
What I have done is:
<xsl:variable name="propertyAlias" select="string('sitemapFooterContent')"/>
Now my issue is, this content (Related Links) results will show on anypage that has HomePage as their template.
I want that Related Field to be shown on all template.
I have tried reading online, even had a look at the videos but cannot find any resource.
In short, what I want to do is:
1. To be able to edit "Related Links" field form some where
2. To be able to show the "Related Links" on all templates at the bottom (meaning adding it to master template)
Can some one guide me how do I do this, I am new to Umbraco so dont know too much.
Thanks You!
Raheel
Hi Raheel,
I'm assuming you'll want different related links per page, so what I would suggest is to create a master document type which works similar to a master template, but for document types. With this, you can define your SiteMapFooter tab on your master doc type, then when you create a new doc type, you can set it's master doc type, to that doc type. This will then make the SiteMapFooter tab available on all doc types which use that master doc type (so you don't have to create it again on each new doc type).
Hope that make sence =)
Matt
Hi Matt,
Thanks for that. I am wondering how do I set a DocumentType as a master.. Sorry I am new to Umbraco but getting there.
Thanks
Raheel
Hi Racheel.
No problem.
Just create your master doc type as usual, and then to create your sub doc type, in the create dialog where you enter the name of your doc type, select your master doc type from the "Master" dropdown list.
Your sub doc type will now inherit all tabs and properties from your master doc type.
Matt
Thanks for that! All sorted and working.
Hi Matt,
I have got the master documents working etc... but I still want somehow to be able to include a Macro in Multiple Template.
What I mean is, I want one Related Link and its information will be displayed on the footer of every page.
What is the best possible way?
Thanks
Raheel
Hi Raheel,
With any piece of functionality or design that you want to appear automatically on each page you need to put this functionality into a master template.
This is explained here, although it's an older article http://umbraco.org/documentation/books/templates-explained
It's also explained in Umbraco.tv http://umbraco.org/documentation/videos/for-site-builders/templating/using-master-templates
The idea is that the master template will always have the related links macro, this macro calls an XSLT file which knows which page the user is on by the use of a variable called '$currentPage', by using this variable you can get XSLT to show the related links for the page the user is visiting.
Hope this helps, best of luck
Rich
Hi Rich,
I did do that.
Templates are:
APSMaster
- ContentPage
- HomePage
- OneColumn
Document Type:
APSMaster
- ContentPage
- OneColumn
- HomePage
FooterLinks (Does not have a master document type)
I created a property of Related Links in FooterLinks document type.
Created a XSLT / Macro and linked it to FooterLinks
Added the macro to ASPMaster template.
Now there are many pages that have ContentPage as template, some have OneColumn as template and Index Page is assigned to HomePage template.
It does not show.
Hi Raheel,
Your set up looks correct.
Try adding some text to your xslt file outside your logic to make sure that the macro is getting called, just something like "test text" this will tell you if your macro is being called.
If you see this text on every page then there's something wrong with your XSLT, if not then you've got something wrong with your set up.
Also you could post your xslt code here.
Rich
Hi Rich,
Here is the XSLT code I have:
version="1.0" encoding="UTF-8"?>
DOCTYPE xsl:stylesheet [ ENTITY nbsp " ">]>
<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"/>
<xsl:variable name="propertyAlias" select="string('footerLinks')"/>
<xsl:template match="/">
<ul>
<xsl:for-each select="$currentPage/* [name() = $propertyAlias and not(@isDoc)]/links/link">
<li>
<xsl:element name="a">
<xsl:if test="./@newwindow = '1'">
<xsl:attribute name="target">_blankxsl:attribute>
xsl:if>
<xsl:choose>
<xsl:when test="./@type = 'external'">
<xsl:attribute name="href">
<xsl:value-of select="./@link"/>
xsl:attribute>
xsl:when>
<xsl:otherwise>
<xsl:attribute name="href">
<xsl:value-of select="umbraco.library:NiceUrl(./@link)"/>
xsl:attribute>
xsl:otherwise>
xsl:choose>
<xsl:value-of select="./@title"/>
xsl:element>
li>
xsl:for-each>
ul>
<xsl:value-of select="umbraco.library:Item($currentPage/@id,$propertyAlias,'')" />
xsl:template>
xsl:stylesheet>
--
The related link field is called footerLinks
Thanks
Raheel
Do you get an empty ul's in your template?
Rich
is working on a reply...