Copied to clipboard

Flag this post as spam?

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


  • Streety 358 posts 568 karma points
    Oct 23, 2013 @ 10:15
    Streety
    0

    Show DAMP Src path to media for all child items

    Hello.

    I use DAMP on my blog. I'd like for the blog home page to show the associated pictures in the summary.

    However I can't seem to get the syntax right and after a day of searching have given up.

    Its nice and easy I don't want cropping just the path to the image so that I can show an image.

    I can't find a method that works.

    On my blog page I have a foreach statement that gets the child objects as expected:

    nodes = ((IEnumerable<DynamicNode>)posts).Take(count).Skip(0);
    
    
            <ul>
                @foreach (DynamicNode n in nodes)
                {
                    <li>
    
                            <h1>
                                <a href="@n.Url" title="@n.GetProperty("ContentTitle").Value">                           
                                @n.GetProperty("ContentTitle").Value</a>
                            </h1> 
    
                           <p>@Library.Truncate(@n.GetProperty("ContentSummary").Value, 500) 
    
                           </p>
    
    
                    </li>
                }
            </ul>
    

    I want to be able to pick up the image called ContentImage also on that page. Each blog has a DAMP image file associated (ContentImage).

    It seems the method I use pickup the single image in the post:

                            dynamic media = Model.MediaById(Model.uBlogsyContentImage);    
                        <img src="@media.umbracoFile" alt="@media.nodeName"  class="blogImage" />
    

    Can't be used as MediaByID only returns a single value.

    So my question is this:

    How can I pickup each photo for each blog entry

    Any help (or pointers) would be gratefully received.

    Thank you.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies