Copied to clipboard

Flag this post as spam?

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


  • lucuma 261 posts 563 karma points
    Jun 08, 2011 @ 16:48
    lucuma
    0

    Displaying more Children than Exist

    I have a very basic scenario. A node(project) has children(photo). On the node's template I'm looping over the children and displaying each photo. I'm going to break out the parts to make it simple:

    var photos = Model.Children;
    ...
     @foreach (var photo in photos){
    
          caption = photo.projectImageCaption;
          caption = caption.Length>66 ? caption.Substring(0,63)+"..." : caption;
    <li>
    <a title="@photo.projectImageCaption" rel="gallery2" href="http://mce_host/forum/developers/razor/@photo.projectImage"><img src="http://mce_host/[email protected]&amp;Class=ProjectDetailThumb" alt="@caption" /></a>
    <div class="title">
    <a href="#">@caption</a>
    </div>
    </li>
    }
    
    Pretty basic, display each photo in a li.  The problem is one of my nodes has 6 children however this exact code is displaying 7.  
    Here are the child nodes (6): http://screencast.com/t/jr4S3c4iZ
    And here is what gets displayed (7): http://screencast.com/t/wIxwR8rKT4fU
    I've republished that particular node and children and it doesn't fix the issue.   Any ideas?  How could this even happen?
  • Steven Newstead 62 posts 103 karma points
    Jun 09, 2011 @ 09:42
    Steven Newstead
    0

     

    Could you spit out the id of each of the nodes on the page, it might be easier to see where that node has come from.

    Perhaps you could try this instead of:

    Model.Children;

    Use

    Model.Pictures (where 'Pictures' is the alias of the nodes you want to display - more details here 

    http://umbraco.com/follow-us/blog-archive/2011/2/23/umbraco-47-razor-feature-walkthrough-%E2%80%93-part-1)

     Finally this could just be a weird caching problem have you tried republishing the entire site? Failing that the old IIS reset?

    If that doesn't work then it must be looking at the physical files on the server in the directory, but that just sounds nonsense.

     

Please Sign in or register to post replies

Write your reply to:

Draft