so where I assign to content variable the macro text is there. However after the rendermacrocontent call the macro string is removed. Am I missing something? I also tried to run the rendermacrocontent using http module so that if it found the macro statement in the rendered content then it would reg ex it out and then render the macro, however I suspect that httpmodule is too late in the page lifecycle to be doing that sort of thing hence i tried it in the template itself where i write out the rich text field.
Ok so in answer to my own question I had to come up with a work around. The package I am working with sends back rendered html so I created an http module that looks for macro tag if it finds it and its oembed one then it uses similar code that is used in the package to get the video html then it replaces the macro marker with the rendered html. Thankfully this is the only macro the client wants to use in the rich text editor. Its not perfect but it works.
I didn't look too much into this issue but I remember we had the same problem on another project before and a collegue of mine just printed-out the field's value using this standard Umbraco way:
Its not issue with uSiteBuilder. If you have rich text edit field and you insert a macro then in a template you use umbraco:Item it all renders fine the macro is rendered. However if you out the field programatically which is what I am doing
where CurrentLangaugeBodyText is a property and it will get the language specific body text depending on language setting then the macro wont render. Another example of this is if you have NON usitebuilder site and you have a macro that gets the rich text content of another node and that nodes rich text field has a macro then that macro will not render it will just output the literal text. If you have xslt or razor macro I believe you can use library.RenderMacroContent. Anyhow with regards to my issue thankfully I managed to re run the code of the macro in an httpmodule so I look for the macro tag and run the same code that is in the macro in the module.
Macro in richtext edit issue
I have rich text edit field and I have inserted macro into the rich text edit. When the page renders the macro text appears are literal text namely
<?UMBRACO_MACRO maxwidth="200"
source="http://vimeo.com/18150336" maxheight="100"
macroAlias="CPalm.Umbraco.Macro.OEmbed" />
The code where I write out the rich text field looks like
this.ltrBodyText.Text = this.CurrentContent.CurrentLanguageBodyText;
where ltrBodyText is an asp.net literal control. I have update the code of the property CurrentLanguageBodyText so that I have
public string CurrentLanguageBodyText
{
get
{
string content = MultiLanguageHelper.GetContentInSelectedLanguageOrDefault(this.BodyText,
new[]
{
this.BodyText,
this.BodyTextBE,
this.BodyTextDE,
this.BodyTextFR,
this.BodyTextSP
});
return library.RenderMacroContent(content, umbraco.NodeFactory.Node.getCurrentNodeId());
}
}
so where I assign to content variable the macro text is there. However after the rendermacrocontent call the macro string is removed. Am I missing something? I also tried to run the rendermacrocontent using http module so that if it found the macro statement in the rendered content then it would reg ex it out and then render the macro, however I suspect that httpmodule is too late in the page lifecycle to be doing that sort of thing hence i tried it in the template itself where i write out the rich text field.
Any ideas?
Ismail
Ok so in answer to my own question I had to come up with a work around. The package I am working with sends back rendered html so I created an http module that looks for macro tag if it finds it and its oembed one then it uses similar code that is used in the package to get the video html then it replaces the macro marker with the rendered html. Thankfully this is the only macro the client wants to use in the rich text editor. Its not perfect but it works.
Regards
Ismail
Hi Ismail,
I didn't look too much into this issue but I remember we had the same problem on another project before and a collegue of mine just printed-out the field's value using this standard Umbraco way:
<umbraco:Item field="FIELD_NAME" runat="server"></umbraco:Item>
We'll look more into why it doesn't work when printed-out through uSiteBuilder - just have to find some time for that.
Regards,
Sasa
Sasa,
Its not issue with uSiteBuilder. If you have rich text edit field and you insert a macro then in a template you use umbraco:Item it all renders fine the macro is rendered. However if you out the field programatically which is what I am doing
this.ltrBodyText.Text = this.CurrentContent.CurrentLanguageBodyText;
where CurrentLangaugeBodyText is a property and it will get the language specific body text depending on language setting then the macro wont render. Another example of this is if you have NON usitebuilder site and you have a macro that gets the rich text content of another node and that nodes rich text field has a macro then that macro will not render it will just output the literal text. If you have xslt or razor macro I believe you can use library.RenderMacroContent. Anyhow with regards to my issue thankfully I managed to re run the code of the macro in an httpmodule so I look for the macro tag and run the same code that is in the macro in the module.
Regards
Ismail
is working on a reply...