Copied to clipboard

Flag this post as spam?

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


  • dominik 711 posts 733 karma points
    Mar 30, 2011 @ 16:11
    dominik
    0

    if statement in template file

    Hi guys,

    Is it possible to use some if statements direct in the  template file? I know normally I should create a macro but this is not possible in this situation because otherwise i have to create five different macros.

    Just want to check if a true/false property is checked an generate some html code

    Thanks

  • Craig Taylor 29 posts 69 karma points
    Mar 30, 2011 @ 16:56
    Craig Taylor
    0

    I've used this in the past for templates: (outputting different macros based on a test)

    <% if (Request.RawUrl.IndexOf("thank-you", 0) == -1)
        {%>
          <!-- INCLUDE TRACKING ON ALL PAGES EXCEPT THANK YOU PAGES --> 
          <umbraco:Macro Alias="SearchForceTracking" runat="server"></umbraco:Macro>
          <% }
          else
          {%>
            <!-- INCLUDE ON THANK YOU PAGES -->
            <umbraco:Macro Alias="SearchForceConversion" runat="server"></umbraco:Macro>
          <%}%>

    -Craig

  • dominik 711 posts 733 karma points
    Mar 30, 2011 @ 19:11
    dominik
    0

    but how can i ask for a property instead of RawUrL

     

    Just if property = true then...

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Mar 30, 2011 @ 19:16
Please Sign in or register to post replies

Write your reply to:

Draft