<umbraco:Macro runat="server" language="razor">
@foreach (dynamic n in Model.Career) {
<div class="current-opening">
<h3>@c.Name</h3>
@c.content
</div>
}
</umbraco:Macro>
It outputs "umbraco.MacroEngines.DynamicXml" instead of the content. However, if the content in the rich text editor starts with a <p> tag, it outputs the content as HTML like expected. Why is this?
Odd behavior with content from a rich text editor
This is strange. When the only content of a rich text editor is a list like:
And I try to just output the content like so:
It outputs "umbraco.MacroEngines.DynamicXml" instead of the content. However, if the content in the rich text editor starts with a <p> tag, it outputs the content as HTML like expected. Why is this?
Hi Michael,
Don't know the exact reason, but have you tried using Html.Raw? ie:
See this similar thread
-Tom
Yep, it produces the same exact thing.
That definitely doesn't seem right, you can get it round it by doing something similar to this.
or you could use GetProperty("bodyText")
Thanks Alex. Basically I had to do this in order for it to work:
@Html.Raw(c.GetProperty("content").ToString())
I'm not sure why it's not working the way it should though. Oh well, time to get a move on with this projects :()
Thanks!
DynamicXML is detecting the markup, there's a few ways to solve it - the easiest is to add ul to the exclude tags list in umbraco.settings
- i'll do this for the next release
If the markup is not valid XHTML then it will also work
The reason the <p> example works is because <p> is an excluded tag
Gotcha, that makes total sense. I didn't even notice that setting in the umbraco.settings. I'll modify it. Thanks so much!
Found a bug - should have returned after detecting it was an RTE, fixed in next release
I'm using 4.7.2 for a new project and I see this bug is still there. Has it been fixed and reintroduced?
Did you make the config change in umbraco.settings to include the ul tag?
Nevermind, it seems to be working, my colleague (new to Razor) misused the Html.Raw function a bit. Sorry for the trouble..
is working on a reply...