Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Profiterole 232 posts 264 karma points
    Apr 05, 2011 @ 17:26
    Profiterole
    1

    bodyText of another node not showing

    Hi guys!

    I have this in the footer of my Mastertemplate :

    <umbraco:item runat="server" field="bodyText" xslt="umbraco.library:GetXmlNodeById(1282)/data[@alias = 'bodyText']" xsltDisableEscaping="true"/>

    which show the bodyText of the node 1282. It works well with docTypes that have bodyText.

    If I go to a page with another docType (child of Mastertemplate) who has no bodyText alias (it might have contactEmail alias, or anything else), my umbraco:item doesn't work. The bodyText of 1282 does not appear.


    How can I solve that without creating a "bodyText" propertie for all my docTypes?

  • Pasang Tamang 258 posts 458 karma points
    Apr 05, 2011 @ 18:01
    Pasang Tamang
    1

    Try by recursive="true" within the umbraco:item.

    Thanks

    Pnima

  • Profiterole 232 posts 264 karma points
    Apr 05, 2011 @ 18:40
    Profiterole
    1

    Thank you, but it doesn't work...

  • Kim Andersen 1447 posts 2197 karma points MVP
    Apr 05, 2011 @ 18:57
    Kim Andersen
    1

    Hi Profiterole

    I haven't tried something like this using umbraco:item's but maybe you could try giving this a shot:

    <umbraco:Item runat="server" field="bodyText" xslt="umbraco.library:GetXmlNodeById(1282)/{0}" xsltDisableEscaping="true"/>

    or this for the legacy XML schema:

    <umbraco:Item runat="server" field="bodyText" xslt="umbraco.library:GetXmlNodeById(1282)/data[@alias='{0}']" xsltDisableEscaping="true"/>

    As I said I haven't tried this before, and I'm not at all sure that this will work, but it's maybe worth a shot.

    Anyway, if I where in you position, I think I would create a small macro for this. Which version of Umbraco are you using?

    /Kim Andersen

  • Profiterole 232 posts 264 karma points
    Apr 05, 2011 @ 19:38
    Profiterole
    1

    Hi Kim,

    For now I'm using 4.5.2 with legacy mode. I tried your idea. It did not work.

    Instead of a macro, I think I'll use a new recursive propertie on my root node.

    Thank you for your help.

  • Kim Andersen 1447 posts 2197 karma points MVP
    Apr 05, 2011 @ 19:43
    Kim Andersen
    1

    Naah, after I re-read my above post I didn't think it would work either. But yeah, you could go for the recursive property as well, if you have the bodyText on your homepage or something like that.

    Whenever you find the solution to your problem could you post it in here, so that we can see it?

    /Kim Andersen

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Apr 05, 2011 @ 20:59
    Lee Kelleher
    5

    Hi Profiterole,

    Try using the NodeId attribute... it's a secret hidden special trick! ;-)

    <umbraco:Item runat="server" Field="bodyText" NodeId="1282" />

    Cheers, Lee.

  • Kim Andersen 1447 posts 2197 karma points MVP
    Apr 05, 2011 @ 21:41
    Kim Andersen
    1

    Damn Lee. That's a very handy ninja trick right there :P

    I've never seen that one before - High five!

    /Kim A

  • Profiterole 232 posts 264 karma points
    Apr 06, 2011 @ 01:22
    Profiterole
    1

    It's not only a ninja trick, it's a secret hidden ninja trick! As expected, it worked.

    Thanks guys!

  • Kevin R. Smith 26 posts 48 karma points
    Feb 27, 2013 @ 23:59
    Kevin R. Smith
    1

    Lee, this was EXACTLY what I was looking for!!!!

    Thank you!

Please Sign in or register to post replies

Write your reply to:

Draft