Run Macro inside RTE that is called from another macro
Hi, I have an Umbraco V4.0.2.1 website and I am trying to insert a macro into the rich text editor that I want displayed on the page in between some text (the macro calls in an advert image from an external database). The problem is the rich text editor text is being pulled in by another macro that calls a user control, this is because only the first 100 words of the text from the rich text editor is allowed to be displayed unless the user is logged into the website with a valid subscription. This of course is not displaying the advert macro and is instead just showing:
I have read and understand that you cannot have a usercontrol macro inside another usercontrol macro and I therefore tried to put the code from the user control that displays the RTE content directly into my template but this still did not work.
Is there anyway I am going to be able to get this to work. Basically what I need is some sort of code whether it be XSLT or ASP.net to display only the first 100 words from the rich text editor unless the user is logged in with a subscription (that means that they are not just a member of the site but are a member and have a specific role). Within the rich text editor I want the end user to be able to insert a usercontrol macro that calls in an inline advert specific for that page. Is there going to any way around this issue that anyone can think of? I hope this all makes sense, please let me know if you need anything explained further, I appreciate any help or suggestions that anyone can offer.
Thank you for the response, can you explain a little further what I need to do with the code above? I assume I put it in my usercontrol that limits the article length, does it matter where? Will this allow me to show an advert any in the richtext editor text?
anywhere in your content. So I think you need to use it before limiting your textlengt. You just need to make sure that the advertisement is not cut I think.
Thanks I will give this a try, so I literally just need to add umbraco.library.RenderMacroContent(input) to my usercontrol that limits the text before the code that actually limits the text? I don't need to replace "input" with anything??
Hmm, I forgot that. The function I suggested does not use codebehind.
The only think I can think of at this time is to use a regular expression to find and load the control yourself using loadcontrol. However maybe there are there core developers who have a better idea. If so I would also like to know it for myself.
Run Macro inside RTE that is called from another macro
Hi, I have an Umbraco V4.0.2.1 website and I am trying to insert a macro into the rich text editor that I want displayed on the page in between some text (the macro calls in an advert image from an external database). The problem is the rich text editor text is being pulled in by another macro that calls a user control, this is because only the first 100 words of the text from the rich text editor is allowed to be displayed unless the user is logged into the website with a valid subscription. This of course is not displaying the advert macro and is instead just showing:
I have read and understand that you cannot have a usercontrol macro inside another usercontrol macro and I therefore tried to put the code from the user control that displays the RTE content directly into my template but this still did not work.
Is there anyway I am going to be able to get this to work. Basically what I need is some sort of code whether it be XSLT or ASP.net to display only the first 100 words from the rich text editor unless the user is logged in with a subscription (that means that they are not just a member of the site but are a member and have a specific role). Within the rich text editor I want the end user to be able to insert a usercontrol macro that calls in an inline advert specific for that page. Is there going to any way around this issue that anyone can think of? I hope this all makes sense, please let me know if you need anything explained further, I appreciate any help or suggestions that anyone can offer.
Many Thanks
Tony
Hi Tony,
In your function to limit the length use:
Doing so wil allow you to use Macro's.
Ron
Hi,
Thank you for the response, can you explain a little further what I need to do with the code above? I assume I put it in my usercontrol that limits the article length, does it matter where? Will this allow me to show an advert any in the richtext editor text?
It replaces the
anywhere in your content. So I think you need to use it before limiting your textlengt. You just need to make sure that the advertisement is not cut I think.
Ron
Hi Ron,
Thanks I will give this a try, so I literally just need to add umbraco.library.RenderMacroContent(input) to my usercontrol that limits the text before the code that actually limits the text? I don't need to replace "input" with anything??
Hi Ron,
I have tried this and it seems to now output the html from my macro usercontrol but does not run any of the code behind. Any suggestions?
Hmm, I forgot that. The function I suggested does not use codebehind.
The only think I can think of at this time is to use a regular expression to find and load the control yourself using loadcontrol.
However maybe there are there core developers who have a better idea.
If so I would also like to know it for myself.
Sorry I can't be more helpful
Ron
Ok Ron,
Thanks for your help anyway.
Is there anyone else out there that can offer any suggestions or advice regarding this?
Can anyone think of another way around the issue?
Many Thanks
Tony
is working on a reply...