Is this being run inside a for-each loop or match template? I ask because you specify the pageid as "@id" - which I think would only work inside a for-each or match template. Have you tried changing to $currentPage/@id?
Oh I see. My problem is, I want to render the doc2form macro only if a document property does not equal 1. I cannot easily edit the user control to do it inside the .net code. How should I go about achieving this?
So there is no way to do this without editing the user control's source? I was hoping there would be a simple way with xslt or built in umbraco functionality..
I think if I do have to edit the source directly I might just create a second template without the comment form and allow the user to switch between the two..
Do you need to do this in an xslt? Might be better in the template itself - so you could have:
<%
string commentStatus = umbraco.presentation.nodeFactory.Node.GetCurrent().GetProperty("uBlogsyPostDisableComments").Value;
if (commentStatus != "1") { %>
<form runat="server">
<umbraco:Macro macroAlias="Doc2FormComplete" Alias="Doc2FormComplete" /> <!-- you need to add you other parameters naturally -->
</form>
<% } else { %>
<br /><div class="info">Comments have been <strong>closed</strong> for this post.</div>
<% } %>
Render macro from xslt - cannot parse error
Hi all,
I need to get an xslt macro to render a usercontrol macro depending on the value of a node property. I am getting a "cannot parse xslt" error:
<xsl:choose>
<xsl:when test="$currentPage/uBlogsyPostDisableComments != 1">
<form runat="server">
<xsl:value-of select="umbraco.library:RenderMacroContent('<?UMBRACO_MACRO macroAlias="Doc2FormComplete" Alias="Doc2FormComplete" DocumentType="10673" Template="" TabName="comment" PageTabs="0" HideTabNames="1" ChooseWhereToStore="[#pageID]" EditMode="0" ShowTitle="0" TitleName="" SaveMemberAlias=", " ShowDescriptions="0" SubmitButtonText="Post" PreviousButtonText="" NextButtonText="" RequiredText="" PublishOnSubmit="0" RefreshToParent="0" RedirectToNode="" PublishWithUserId="" StorePropertiesInCookies="" SendEmailResponse="0" ResponseSubject="" ResponseEmailFieldAlias=", " ResponseCopyTo="" EmailForm="0" FormSubject="" FormToEmailAddress="" FormFromEmailAddress="" UseAjax="1" DefaultValueNode="" TextOnSubmit="Thanks for your comment. It will be moderated then published." runat="server" runat="server"></?UMBRACO_MACRO>', @id)" disable-output-escaping="yes"/>
</form>
</xsl:when>
<xsl:otherwise>
<br /><div class="info">Comments have been <strong>closed</strong> for this post.</div>
</xsl:otherwise>
</xsl:choose>
I wrote the macro tag according to this document:
http://en.wikibooks.org/wiki/Umbraco/Reference/umbraco.library/RenderMacroContent
Notice the "Version 4 warning" paragraph.
I am using Umbraco version 4.7.
Can anybody see what is going wrong?
Thanks,
Max.
Hi,
Is this being run inside a for-each loop or match template? I ask because you specify the pageid as "@id" - which I think would only work inside a for-each or match template. Have you tried changing to $currentPage/@id?
-Tom
Max,
You can't use RenderMacroContent() for a macro referencing a user control. So, even if you get the syntax right, it simply won't work.
Cheers,
/Dirk
Oh I see. My problem is, I want to render the doc2form macro only if a document property does not equal 1. I cannot easily edit the user control to do it inside the .net code. How should I go about achieving this?
Thanks.
Max.
Max,
Need some c# code for that as in
(may need a cast to boolean as .Value() returns a string. Don't forget to include the necessary assemblies such as umbraco, cms, businesslogic)
Cheers,
/Dirk
So there is no way to do this without editing the user control's source? I was hoping there would be a simple way with xslt or built in umbraco functionality..
I think if I do have to edit the source directly I might just create a second template without the comment form and allow the user to switch between the two..
Thanks
Do you need to do this in an xslt? Might be better in the template itself - so you could have:
Perfect! I hadn't thought of inline .net as I'v never used it before. Thanks for the help everybody.
is working on a reply...