To dynamically bring image in list - home page

Topics: General
Sep 8, 2011 at 2:38 PM

Hi friends,

I have several content pages like bussiness,U.S, world etc,, I displayed images in these content pages by using img url from the media...I created list and added these content pages and showed in home page..but its showing title,tags,summary etc but my image is not it possible to display my image in list with the content page...please its urgent...please do this helpfull...




Sep 8, 2011 at 4:23 PM

I'm not clear on what you mean by "using img url from the media". Do you mean that you're just embedding images in the body content by using the media picker? If so, those won't be displayed in summary view by default because the summary template for the Body strips out the HTML and just displays the first 200 characters of the body text.

You can see that in the Parts.Common.Body.Summary template in Core/Common/Views:

    Orchard.ContentManagement.ContentItem contentItem = Model.ContentPart.ContentItem;
    string bodyHtml = Model.Html.ToString();
    var body = new HtmlString(Html.Excerpt(bodyHtml, 200).ToString().Replace(Environment.NewLine, "</p>" + Environment.NewLine + "<p>")); 
<p>@body @Html.ItemDisplayLink(T("more").ToString(), contentItem)</p>
You can override this template in your theme if you want to actually render the full body instead of the excerpt text as the default template is doing.