Forums / Setup & design / Complicated fetch...
Christian Johansen
Wednesday 05 July 2006 7:08:31 am
I'm trying to do a fetch that I'm not sure is possible. I don't know how to do it anyways, so I was hoping for some input. This is my situation:
Content structure - Articles - Cat 1 - article 1 - article 2 - ... - Cat 2 - article 1
and so on.
These use images stored in the media library through it's related objects. There's no custom image input on the article class, just related objects to store the images. Now what I want to do is to display all images from Category 1 and so on. That is - objects of type "image" related to the children and grandchildren of the current node. Is this possible? I can see a few ways to hack it, but not without generating (literally) a thousand sql queries... Has anyone done anything like it?
Pål Jostein Didriksen
Saturday 08 July 2006 10:28:38 am
Well, I'm thinking that it should be possible to do it like this:
- fetch content tree, set the class_filter_array to 'article'
- loop through the contents and display the related object by using {attribute_view_gui attribute=$node.something}
Another possibility could be to create a line view template override for the class article, that will only display the image. Check the line view template you already have for displaying articles, it should give you the code needed to display the images.