Copied to clipboard

Flag this post as spam?

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


  • Phillip Ng 148 posts 250 karma points
    Nov 06, 2011 @ 01:18
    Phillip Ng
    0

    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!

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 06, 2011 @ 15:42
    Jan Skovgaard
    0

    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

  • Phillip Ng 148 posts 250 karma points
    Nov 06, 2011 @ 21:05
    Phillip Ng
    0

    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 "&#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"/>

    <xsl:template match="/">
      <xsl:variable name="home" select="$currentPage/ancestor-or-self::*[@parentID=-1]" />
      <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.


  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 06, 2011 @ 21:42
    Jan Skovgaard
    0

    Hi Phillip

    Seems like the <header> element is not closed?

    /Jan

  • Phillip Ng 148 posts 250 karma points
    Nov 07, 2011 @ 00:29
    Phillip Ng
    0

    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>

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Nov 10, 2011 @ 11:24
    Tim
    0

    @Phillip,

    Are the macros cached? If they are, disable the caching on the Macro and see if the issue still occurs.

Please Sign in or register to post replies

Write your reply to:

Draft