I would like to be able to add more data than description and title as caption, for example, resolution, filesize or a download link to the original file.
I have tried adding more fields to the view that the 4 required ones (2 image URLs, description, title), but I don't know now how could I exactly access those fields.
The 'fields' variable only exposes the 4 galleriffic specific fields: title_field, description_field, thumbnail_field, slide_field; no matter if you have more fields on the view.
Do you know the best way to access those other fields? The only place I can see them is the 'view' variable itself but even from there I don't know which would be the way to access the field for a specific row.
It would be even better if galleriffic row style could expose those other fields too. No matter if the default gallerific template (views-galleriffic-view-gallerifficrows.tpl.php) doesn't use them but it would be very helpful to any one who wants to code his own template files including more data for each image. I don't know if it is possible to expose those other fields, but if it is possible it would be highly appreciated.
Comments
Comment #1
acouch CreditAttribution: acouch commentedYou can add more elements to the description by adding fields above them in the Fields area of the view and selecting 'Rewrite Output of this field' for the field you use as the description. You can use tokens from the other fields and add them to the description.
Comment #2
manfer CreditAttribution: manfer commentedI haven't thinked of something like that.
Thanks.
Comment #3
manfer CreditAttribution: manfer commentedAt first glance it looked a good solution for me but it is not enough. The only thing that I didn't like of that solution was not having the other fields independent so they could be themed in any way I wanted later in tpl.php files and CSS. Being atacched to description field gives you less control when theming.
Anyway it was enough for me until I found I can't use html. Though views let's you use Full html for the rewrite, views_galleriffic module is filtering that html unless I change the drupal global input format to "Full HTML" which is not desirable in most cases. On views_galleriffic.module line 68:
So if on my description field I use rewrite as text and define it something like this:
I get an output like this:
which I can't style as I want with CSS and is not the output I was expecting from views. The output I was expecting and the one I get if I set drupal global default filter to Full HTML or just commenting out the line in views_galleriffic.module that filters it, is:
Comment #4
acouch CreditAttribution: acouch commentedhi Manfer:
Thank you for posting this and for your in-depth reply. It is useful for other who want to use this module and as the maintainer to hear your use case.
You've identified a short-coming of the module that I'm not going to fix in the interest of simplicity. It could be setup so you add multiple elements to the description but I think that would make it harder for average users.
If you want to customize a view using galleriffic to the extent that you have I would advise making your own view template files. There is a description of how to do this here: http://drupal.org/node/441846
Comment #5
riyana56 CreditAttribution: riyana56 commentedI figured out a simple solution to this problem.
1. In your View, add the additional fields you want to have displayed. For example, I added Node ID because I wanted to create a link to the node.
2. Open up the file views_galleriffic_plugin_row_gallerifficrows.inc (located in /sites/all/modules/views_galleriffic/).
3. Near the top you will see a function called option_definition(). Duplicate one of those lines, and change the info as applicable. I added:
$options['web_field'] = array('default' => '');
4. Scroll down and you will see the options_form function. Duplicate one of those chunks and change the info as applicable. I added:
5. Now edit views-galleriffic-view-gallerifficrows.tpl.php so that the new field you created shows up where you want it to. I edited my code so that it prints the Node ID as part of the href link:
<a class="more" href="?q=node/<?php print $fields['web_field']->content; ?>">Read More <span>>></span></a>
6. Final step - go back to your View and Configure the Row Style. You will see a new dropdown. Select the field that corresponds to the new field you're adding. Save the Row Style, save the view, and you're done.
I hope this helps you.
Comment #6
ippy CreditAttribution: ippy commentedHaving essentially just figured out and implemented what is suggested in #5 (rather unfortunately without having come across this issue first ... ) I found that #5 is still good (for Views Galleriffic 6.x-1.4).
In my use-case I needed some additional image_field data fields (brought in via imagefield_extended) and needed to get them included and printed in the "gallery".
The only downside to this approach is that:
- it is highly custom, case-by-case;
- will need reinstating in the event of updates to views_galleriffic_plugin_row_gallerifficrows.inc;
Probably there could be a more elegant solution, but in practice the module itself seems very stable with few updates rolled out and only one file is hacked, so it could be worse.
Of course, where at all possible, the solution proposed by the maintainer in #1 would be a more transparent, sustainable, and thus preferable, approach to take.