I working on a new umbraco and need to get an image from a media picker. I have done this before without any problems. But now the macro renders nothing. It's the same Umbraco version in both installs.
The code from the working one looks like this:
@inherits Umbraco.Web.Macros.PartialViewMacroPage @{ if (CurrentPage.HasValue("newsImg")){ var image = Umbraco.Media(CurrentPage.newsImg); <img src="@image.GetCropUrl("umbracoFile", "NyhedsBillede")" alt="@image.Name" /> } }
The one thats renders nothing and gives no errors looks like this:
@inherits Umbraco.Web.Macros.PartialViewMacroPage @{ if (CurrentPage.HasValue("billede")){ var image = Umbraco.Media(CurrentPage.billede); <img src="@image.GetCropUrl("umbracoFile", "KolonneBillede")" alt="@image.Name" /> } }
When I try to render a text field from from the page nothing renders either. I use this:
@Umbraco.Field("billede1Tekst")
Both macros are inserted in my template. When I add some lorem ipsum text to the non-working one it renders fine. All my aliases are correct and so on.
Any ideas why the image or text fields are not rendering?
Get image on currentpage from media picker
Hi guys
I working on a new umbraco and need to get an image from a media picker. I have done this before without any problems. But now the macro renders nothing. It's the same Umbraco version in both installs.
The code from the working one looks like this:
The one thats renders nothing and gives no errors looks like this:
When I try to render a text field from from the page nothing renders either. I use this:
Both macros are inserted in my template. When I add some lorem ipsum text to the non-working one it renders fine. All my aliases are correct and so on.
Any ideas why the image or text fields are not rendering?
/Michael
Hi again guys
I figured out what was causing the mystery. I changed doctype on the page that had to render the content. Mabye a cache somewhere I needed to clear?
Fix = I deleted the old one a made a new one as the right doctype.
Sorry for being a little quick on the trigger :)
is working on a reply...