Copied to clipboard

Flag this post as spam?

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


  • Stephen Davidson 216 posts 392 karma points
    Dec 07, 2012 @ 17:34
    Stephen Davidson
    0

    Display image from homepage using Razor

    Just started using DAMP and I'm using the following code to display a logo in the footer area

    dynamic media = Model.MediaById(Model.footerLogo);
    <img src="@media.umbracoFile" alt="@media.nodeName" height="40px"/>

    Which works if I'm on the home page, any other page it wont, how do i make this recursive so it displays at any level?

    Regards,

    S

  • Stephen Davidson 216 posts 392 karma points
    Dec 07, 2012 @ 17:36
    Stephen Davidson
    0

    Ah darn it i got it right after i posted! Simples!

    dynamic media = Model.MediaById(Model.AncestorOrSelf().footerLogo);
  • Jeroen Breuer 4909 posts 12266 karma points MVP 5x admin c-trib
    Dec 07, 2012 @ 17:40
    Jeroen Breuer
    0

    Glad you got it fixed. I think this will also work:

    dynamic media = Model.MediaById(Model._footerLogo);

    Jeroen

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies