Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hey guys I'm new to razor and am simply trying to output an image thats a media node
Been trying a load of things in this script. Its an umbraco 4.7.2 site
@using umbraco.cms.businesslogic.media;@{ var pagesToList = @Model.Children.Where("Visible"); //groups items <div id="experts"> <div class="row"> @foreach (var expertItem in pagesToList ) { <article class="expert"> <h3><a href="@expertItem.Url">@expertItem.expertForename</a></h3> <p>@expertItem.expertSurname</p> <p>@expertItem.expertEmail</p> <p>@expertItem.expertPhoneNumber</p> <img src="@Model.MediaById(1187).umbracoFile" /> <p>@expertItem.expertPhoto</p> <p>@expertItem.expertAreas</p> </article> } </div> </div> }
However I just get Error loading MacroEngine script (file: RazorExpertList.cshtml)
Can you help me please :)
Hi Andy.
I am copy & paste your code and razor is loading without any errors...
How do you try to loading the macro?
Hey thanks for your reply
I'm simply calling it from a template as
<%@ Master Language="C#" MasterPageFile="~/masterpages/Master.master" AutoEventWireup="true" %><asp:Content ContentPlaceHolderId="BodyContentPlaceHolder" runat="server"> <umbraco:Macro Alias="RazorExpertList" runat="server" /></asp:Content>
Mmm.. that sounds strange..
Your macro is conected to your script file?
If I remove the line
<img src="@Model.MediaById(1187).umbracoFile" />
the script runs fine and all the other info is displayed as expected, so yes the script is running fine until I try and add the image code
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Simple Image display issue
Hey guys I'm new to razor and am simply trying to output an image thats a media node
Been trying a load of things in this script. Its an umbraco 4.7.2 site
@using umbraco.cms.businesslogic.media;
@{
var pagesToList = @Model.Children.Where("Visible");
//groups items
<div id="experts">
<div class="row">
@foreach (var expertItem in pagesToList )
{
<article class="expert">
<h3><a href="@expertItem.Url">@expertItem.expertForename</a></h3>
<p>@expertItem.expertSurname</p>
<p>@expertItem.expertEmail</p>
<p>@expertItem.expertPhoneNumber</p>
<img src="@Model.MediaById(1187).umbracoFile" />
<p>@expertItem.expertPhoto</p>
<p>@expertItem.expertAreas</p>
</article>
}
</div>
</div>
}
However I just get Error loading MacroEngine script (file: RazorExpertList.cshtml)
Can you help me please :)
Hi Andy.
I am copy & paste your code and razor is loading without any errors...
How do you try to loading the macro?
Hey thanks for your reply
I'm simply calling it from a template as
<%@ Master Language="C#" MasterPageFile="~/masterpages/Master.master" AutoEventWireup="true" %>
<asp:Content ContentPlaceHolderId="BodyContentPlaceHolder" runat="server">
<umbraco:Macro Alias="RazorExpertList" runat="server" />
</asp:Content>
Mmm.. that sounds strange..
Your macro is conected to your script file?
If I remove the line
<img src="@Model.MediaById(1187).umbracoFile" />
the script runs fine and all the other info is displayed as expected, so yes the script is running fine until I try and add the image code
is working on a reply...