Hi,
this is a follow-up to
Since 'Views Gallery' 6.x-1.3, there is a node-based view "view of all Galleries"; this is not very flexible, and it's pretty ugly since the raster view includes $links
etc. I'd like to access the image node's fields and put them into tables (as it is possible with Image module's 'Image Gallery').
So the question is: How do we build a tabular or other field-based listing of galleries which includes at least one image from the views gallery?
Poieo suggested to use a Reverse Node Reference; I can not try this approach since this module requires MySQL 5.1, but Debian/Lenny ("stable") comes with MySQL 5.0.51a. So hopefully there are other ways to expose 'views gallery's fields to views.
Is this even possible, and has anyone solved this issue already?
Thanks & greetings, -asb
Comment | File | Size | Author |
---|---|---|---|
#4 | views-gallery-latest-galleries.txt | 12.44 KB | asb |
Comments
Comment #1
Poieo CreditAttribution: Poieo commentedI haven't tried this yet, but you may be able to use Corresponding Node Reference to create a two-way reference between the gallery node and the attached image nodes.
By having a reference from the gallery to the images, you should be able to pull the fields from the image nodes into your view.
Another option I used was to add an image field to your gallery content type to be used as the gallery thumbnail. Obviously, this is not necessarily ideal as you would probably rather pull an image from your gallery. But it is a simple solution for those looking for a quick fix.
Comment #2
asb CreditAttribution: asb commentedThanks for the pointer, I was usually using the 'Node referrer' module (similar functionality), and played a bit with CNR. However, as far as I have seen, it doesn't play well together with 'Views Gallery' (maybe the Nodereference from URL widget?), but I'll continue trying.
Comment #3
zarudnyi CreditAttribution: zarudnyi commentedI override teaser view of gallery node type with contemlate module to show only
print $node->content['gallery_node_content_2']['#value']
(in my case).That's all. Than I setting up my views for raw style node/teaser and filter for show only gallery node type.
Comment #4
asb CreditAttribution: asb commented@aluminium: That's a workaround which might work for you, but I need something different - full-featured fields and non-node-based view styles.
@Poieo: Your idea was quite helpful for me, even without being able to use CNR: The mentioned NodeReferrer module offers a robust views integration and can be used to "bridge" between back-referencing nodes as well (simply add a required relationship to your view and set it to "distinct"). After having remembered this, it was a walk in the park to access some image from the 'Gallery' nodetype from within views. So the problem is solved at least partially. Two problems remain:
Maybe someone has an idea with those two issues?
In case that someone wants to try this out, I'm attaching a stripped-down export of my view (it's extremely trivial). Additional modules required: NodeReferrer. The relevant view is called "latest galleries (block)", it contains some fields you might wish to remove. The crucial elements are:
The rest is IMHO irrelevant. Well, this is far from perfect but a whole lot better than nothing ;)
Thanks for your ideas & greetings, -asb
Comment #5
Poieo CreditAttribution: Poieo commentedFor #2, you should be able to add a field for 'path to node' (for the gallery node) before the image thumb and 'exclude it from display'. Then, you can use this URL to link the image to the gallery by re-writing the display. So you'd have something like this:
Comment #6
asb CreditAttribution: asb commented@Poieo:
Thanks, this recipe does also work for the 'NodeReferrer' approach (#4) - it sounds a bit hackish, but it's cool!
Now just selecting a certain image as "gallery thumbnail" remains on the wishlist. Maybe I'll try to set a flag and filter the view down to the one flagged node. Hmm...
Greetings, -asb
Comment #7
asb CreditAttribution: asb commentedbetter (?) title...
Comment #8
Hunkah CreditAttribution: Hunkah commentedOK I'm still sorta new to PHP coding, so I am a bit lost as to where you guys are adding this code. Can you be a sweetheart and dumb this down a little?
Thanks.
Comment #9
asb CreditAttribution: asb commentedSo far this appreach has nothing to do with PHP, it's purely Views.
If some of the remaining issues are sorted out, I'll write a handbook page and/or provide an exported sample view. But it's really simple if you follow the instcructions from #4 and #5. However, maybe it makes sense to offer this as an contributed addition to the module if people are really having trouble to reproduce it. Any thoughts, Karen?
Comment #10
Hunkah CreditAttribution: Hunkah commentedMy issue isn't really with the code, if it works... it works.
My issue is where do I insert the information within views-gallery-latest-galleries.txt and where do I put [token for image thumb]. It's a little vague to me.
Thanks for your reply, I know us Newbies can be a little trying at times.
-Edit-
Wait, figured out the views-gallery-latest-galleries.txt, it goes into import views... yet I get this error:
* Field handler node_counter.daycount is not available.
* Field handler node_counter.totalcount is not available.
* Relationship handler node.nodereferer_referers is not available.
* Unable to import view.
Comment #11
asb CreditAttribution: asb commentedSomething which provides the View with backlinks is required; I'm using 'NodeReferrer' (#4), 'Corresponding Node Reference' (#1) should work as well or even better, at least if you're running MySQL 5.1. However, you'll need these backlinks to build a relationship. The other field handlers can be discarded (#4).
If you don't know what I'm talking about, please wait until we've figured out #6 and the promised tutorial.
Comment #12
Hunkah CreditAttribution: Hunkah commentedYeah, I'm lost. I will wait. Thanks a lot for being so cool :)
Comment #13
Poieo CreditAttribution: Poieo commentedThe problem with a field in the node content type that determines the gallery thumb is deselecting one before selecting another. If you want to change the current thumb, you have to make sure any previous thumbs are no longer selected... Seems like the simplest approach, but could be a UI nightmare down the road.
To muddy the waters a bit more, I'm using Draggable Views to determine the order of my image gallery. Do this, and you can simply allow the first image in the list to be the gallery thumb because you can control which image is first buy other means than the upload order.
But, this means the first (or last) image in the gallery must be the gallery thumb. I can see how many users would not want the first image to be the thumb for one reason or another.
Not sure that helps...
Comment #14
madlee CreditAttribution: madlee commentedsubscribe
Comment #15
asb CreditAttribution: asb commentedThe approach from #4 doesn't work anymore in Views3, maybe because the "distinct" operator works differently. However, except a list of one record per gallery I get a list of all images in the gallery with Views3 :-(
Comment #16
holeepassion CreditAttribution: holeepassion commentedI have created a new content type with image field. I have done the views to display the field as grid, as below:
http://earthsmate.com/downloadfreeimage
I have created a field with type in the content type. How do I group the images under each type and list them on the page with links to the gallery types, which then are then linked to all the images. I want the images to be thumbnail with links also.
thank you
cheers