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
    Jul 12, 2011 @ 15:01
    dominik
    0

    Render contour form inside macro

    Hello,

    I am using a macro to display some tabs on my page. Inside this tabs i want to add a umbraco contour form. If i do so i get a

    <?UMBRACO_MACRO

    inside my code. Is there a way to render this macro correct?

    If i use a normal template it works but it should also be rendered inside my macro

  • dominik 711 posts 733 karma points
    Jul 14, 2011 @ 15:27
    dominik
    0

    Anybody any solution for it?

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jul 14, 2011 @ 15:31
    Tom Fulton
    0

    Are you inserting the macro into a Rich Text Editor, and calling the RTE's contents from another Macro?

    If so you need to wrap it in the umbraco.library:RenderMacroContent(content, pageid) function to make sure the macros render.  This is done automatically in templates but if you are calling an RTE from a macro you need to handle it manually:

    My Tab Content:
    <xsl:value-of select="umbraco.library:RenderMacroContent($currentPage/yourRteField, $currentPage/@id)"/>

    -Tom

  • dominik 711 posts 733 karma points
    Jul 14, 2011 @ 15:37
    dominik
    0

    Ok so where i have to paste this code into? the macro is not always there - only on some specific pages

    I ve got dynamic tabs which are generated via xslt - in these tabs i sometimes need to add a contour form (with RTE macro plugin).

    Thanks

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jul 14, 2011 @ 15:44
    Tom Fulton
    0

    That's fine - the RenderMacroContent function will render your RTE's contents like normal, and if it finds a macro inserted it will also render that.  So even if you don't have a macro in your RTE it's safe to use.

    You would replace wherever your current code is calling the RTE with the above.  Also I forgot to add, make sure to include disable-output-escaping="yes" like you would normally do.

  • dominik 711 posts 733 karma points
    Jul 14, 2011 @ 15:57
    dominik
    0

    so what i have until now is:

    <xsl:value-of select="umbraco.library:RenderMacroContent($currentPage/contentTab3Text, $currentPage/@id)" disable-output-escaping="yes" />

    contentTab3Text is the conten of tab3 and inside it i want to place my contour form with alias umbracoContour.RenderForm 

    If I use

    <xsl:value-of select="umbraco.library:RenderMacroContent($currentPage/umbracoContour.RenderForm, $currentPage/@id)" disable-output-escaping="yes" />

    it is not working - only on first tab this works on each other tab i get an previous - next button :)

     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jul 14, 2011 @ 17:40
    Tom Fulton
    0

    Are you inserting the form into the RTE or are you wanting to use a form picker?  What exactly is umbracoContour.RenderForm?

  • dominik 711 posts 733 karma points
    Jul 14, 2011 @ 18:58
    dominik
    0

    Yes i am using the normal contour macro formpicker. And umbracoContour.RenderForm is the alias of the macro (default contour setting)

     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jul 14, 2011 @ 19:58
    Tom Fulton
    0

    What code were you using in your original post that outputted the  <?UMBRACO_MACRO text?  You should be able to just wrap this in the RenderMacroContent

  • dominik 711 posts 733 karma points
    Jul 14, 2011 @ 20:23
    dominik
    0

    i just add one contour form with RTE into my tab usercontrol and in the page source i see this <?UMBRACO_MACRO

    I think it is not rendered in the correct way

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jul 14, 2011 @ 20:34
    Tom Fulton
    0

    If you are getting that output, you should be able to wrap whatever code is producing that output int he RenderMacroContent function, and that (should) transform the <?UMBRACO_MACRO tags into the actual output of the macro.  I would need to see your code that outputs that to show how you would add it.

    However I just realized something, according to a recent post by Dirk you can't use RenderMacroContent for a user-control macro, which I think the RenderForm macro is.  It looks like it might not be possible to render a Contour form from XSLT according to this post...not sure if there are any alternatives.

  • dominik 711 posts 733 karma points
    Jul 15, 2011 @ 08:11
    dominik
    0

    SO inside my template i include my xslt macro which displays the tabs :

    <umbraco:Macro Alias="ContentTabs" runat="server"></umbraco:Macro>

    Inside this XSLT macro i want to display the contour form in the tab the user has put it into:

    <xsl:if test="$currentPage/contentTab2Headline != '' ">
                  <div style="display: none;" class="tab" id="tab2">
                     <xsl:value-of select="umbraco.library:RenderMacroContent($currentPage/contentTab2Text, $currentPage/@id)" disable-output-escaping="yes" />
                  </div>
                </xsl:if>
                <xsl:if test="$currentPage/contentTab3Headline != '' ">
                  <div style="display: none;" class="tab" id="tab3">
                    <xsl:value-of select="umbraco.library:RenderMacroContent($currentPage/contentTab3Text, $currentPage/@id)" disable-output-escaping="yes" />
    </div>
    </
    xsl:if>

    contentTab2Text and contentTab3Text are the content RTE content sections of the editor where i added the contour form.

    But it is not displaying the contour forms in the tabs

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jul 15, 2011 @ 15:32
    Tom Fulton
    0

    Hi Dominik,

    Unfortunately it looks like it might not be possible to render a Contour form from an XSLT macro, due to the fact that RenderMacroContent does not work with usercontrol macros - see this thread for more details

    -Tom

  • dominik 711 posts 733 karma points
    Jul 15, 2011 @ 16:10
    dominik
    0

    Yes and how can i now solve this issue? is there any solution for it?

Please Sign in or register to post replies

Write your reply to:

Draft