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 4908 posts 12265 karma points MVP 4x 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

Please Sign in or register to post replies

Write your reply to:

Draft