Copied to clipboard

Flag this post as spam?

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


  • Andy 4 posts 24 karma points
    Jul 26, 2012 @ 16:23
    Andy
    0

    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 :)

  • gilad 185 posts 425 karma points
    Jul 26, 2012 @ 16:37
    gilad
    0

    Hi Andy.

    I am copy & paste your code and razor is loading without any errors...

    How do you try to loading the macro?

     

  • Andy 4 posts 24 karma points
    Jul 26, 2012 @ 16:39
    Andy
    0

    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>

  • gilad 185 posts 425 karma points
    Jul 26, 2012 @ 16:42
    gilad
    0

    Mmm.. that sounds strange..

    Your macro is conected to your script file?

  • Andy 4 posts 24 karma points
    Jul 26, 2012 @ 16:45
    Andy
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft