Has anyone had a problem with a macro running after a page postback? I have three different websites running on one Umbraco (4.5.2) installation. A macro will render a different logo depending on the which website the user is on.
Only recently did we start noticing that after a contact form submission was made, the logo disappears -- not even the <a> tag renders. This hadn't been a problem previously. I did some troubleshooting and somehow think on postback, the first umbraco tag in the <body> doesn't render. Anybody seen or experienced this before? There are two macros that occur before the logo rendering, but those are in the <head> and they work. When I remove the logo macro, the next umbraco tag which is umbraco:Item, doesn't work. I just added a test macro tag before the logo, and the logos appear. Any advice? Thanks in advance!
What value are you trying to render with the umbraco:Item? And is there markup around it? Like <div><umbraco:Item /></div>...I'm thinking that maybe if the value is empty it could mess up the rendered HTML perhaps?
So when I remove the "SetTitleImage" macro from the HTML, the Umbraco:Item tag doesn't render. When the Umbraco:Item is removed, the next macro doesn't appear. The temporary fix I've been using is adding a test macro before the SetTitleImage.
Umbraco tags don't render on postback?
Hello everyone
Has anyone had a problem with a macro running after a page postback? I have three different websites running on one Umbraco (4.5.2) installation. A macro will render a different logo depending on the which website the user is on.
Only recently did we start noticing that after a contact form submission was made, the logo disappears -- not even the <a> tag renders. This hadn't been a problem previously. I did some troubleshooting and somehow think on postback, the first umbraco tag in the <body> doesn't render. Anybody seen or experienced this before? There are two macros that occur before the logo rendering, but those are in the <head> and they work. When I remove the logo macro, the next umbraco tag which is umbraco:Item, doesn't work. I just added a test macro tag before the logo, and the logos appear. Any advice? Thanks in advance!
Hi Phillip
What value are you trying to render with the umbraco:Item? And is there markup around it? Like <div><umbraco:Item /></div>...I'm thinking that maybe if the value is empty it could mess up the rendered HTML perhaps?
/Jan
Hey Jan
This is the html for the body:
`<body>
<header>
<umbraco:Macro Alias="SetTitleImage" runat="server"></umbraco:Macro>
<div>
<p>Call Us: <span><umbraco:Item field="phoneNumber" recursive="true" runat="server"></umbraco:Item></span></p>
</div>
<umbraco:Macro Alias="Navigation" level="1" caps="true" runat="server"></umbraco:Macro>`
and the xslt for the SetTitleImage macro
`<?xml 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:template match="/">
<xsl:variable name="home" select="$currentPage/ancestor-or-self::*[@parentID=-1]" />
<a class="first_child">
<xsl:attribute name="href">
<xsl:value-of select="umbraco.library:NiceUrl($home/@id)" />
</xsl:attribute>
<xsl:attribute name="style">background-position:<xsl:choose><xsl:when test="$home/@template=1044">0 0;</xsl:when><xsl:when test="$home/@template=1167">0 -66px;</xsl:when><xsl:when test="$home/@template=1170">0 -133px;</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
1
</a>
</xsl:template>
</xsl:stylesheet>`
So when I remove the "SetTitleImage" macro from the HTML, the Umbraco:Item tag doesn't render. When the Umbraco:Item is removed, the next macro doesn't appear. The temporary fix I've been using is adding a test macro before the SetTitleImage.
Hi Phillip
Seems like the <header> element is not closed?
/Jan
Sorry, i didn't include the rest of the <header>. It is closed correctly though =D
<header>
<umbraco:Macro Alias="Test" runat="server"></umbraco:Macro>
<umbraco:Macro Alias="SetTitleImage" runat="server"></umbraco:Macro>
<div>
<p>Call Us: <span><umbraco:Item field="phoneNumber" recursive="true" runat="server"></umbraco:Item></span></p>
</div>
<umbraco:Macro Alias="Navigation" level="1" caps="true" runat="server"></umbraco:Macro>
<umbraco:Macro Alias="CreateServiceLogos" runat="server"></umbraco:Macro>
</header>
@Phillip,
Are the macros cached? If they are, disable the caching on the Macro and see if the issue still occurs.
is working on a reply...