Hi there,
Here's what I'm trying to do:
I'm trying to display a themed teaser (overridden with node.tpl.php for several node types, each having their own distinct buttons/etc, but fitting the same general slideshow context) in the main frame. If I use fields display (to have breakouts) and use Node: Teaser as main frame field, the theming is ignored. So instead, I want to use a Node: Nid field and use views-view-fields--slideshow.tpl.php to override it with a themed teaser.
The problem I'm running into is that Views Slideshow displays the field contents as they show up BEFORE they are themed. Is there a way to display views fields as they would appear after all the usual views theming operations?
Thanks,
Andrey.
P.S. Please let me know if you think I can accomplish this a better way.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | g-flyer-1-web.jpg | 82.85 KB | mr.andrey |
Comments
Comment #1
redndahead commentedIs this the same issue that you mentioned in #763614: Thumbnail Hover - no teaser display that you said you would ask in the views issue queue?
Comment #2
mr.andrey commentedIt's related, and I did some digging in views threads, but I believe the main issue is in Views Slideshow. Normally views output can be overridden by using views-view-fields--viewname.tpl.php, however, Views Slideshow Main Frame somehow ignores that default behavior, outputting the raw value of the field. The main frame output is too early in the view process and needs to be fully rendered first, so it can be themed as views, so the views can be themed.
An easy way to see this in action would be to create a normal view (not slideshow) and output the node ids as fields. Your output will be "1,2,3,etc". Now, create a views-view-fields--viewname.tpl.php with the following code:
The output of this view will be "abc,abc,abc,etc" and drupal message will also say "abc,abc,abc,etc";
However, if we change the view to be a slideshow type, and the nid field to be in the main frame, the output will be "1,2,3" while the drupal message says "abc". The normal views override is ignored.
That's my reasoning for it being a views slideshow issue rather than a views issue.
Thanks,
Andrey.
Comment #3
mr.andrey commentedComment #4
redndahead commentedYou are trying to override the row output. In views slideshow you would do this using yourtheme_views_slideshow_thumbnailhover_no_display_section($view, $rows, $id, $options, $teaser = TRUE) {} in your template.php file. Look at views_slideshow_thumbnailhover.theme.inc for what the current function is.
Now is this the best way to handle it? I don't think so I think we need to provide more tpl.php files. I am not the most knowledgeable in how to do this for views theming. I don't know if you are at drupalcon, but if you are feel free to find me and we can discuss it. I'll try to do a bof on views slideshow. Otherwise look for the big, and not as in tall, red headed dude named Adam Moore.
Tell me if the theme override solution works for you.
Comment #5
mr.andrey commentedI'm not at DrupalCon, but I live in Berkeley, which is very close. If you don't have any plans tonight, there's an amazing pianist/vocalist friend of mine who will be playing at Cafe Gratitude in Berkeley 7-10pm. I'm planning on being there. I'll attach the flyer.
I'll check out the theme function and report back.
Andrey.
Comment #6
mr.andrey commentedWell... I got it to work using the following:
But it does seem a bit roundabout just to get the tpl-overridden teaser to display correctly.
Just to summarize what I did for reference:
* Create a view (Views Slideshow)
* Add set it to Thumbnail Hover
* Add two fields - Node:Nid and whatever other you want to use for breakouts
* Slideshow settings: set Node:Nid as the main frame and the other field as breakouts
* Override your node teaser display using node.tpl.php
* Use the above function to convert Node:Nid field into an overridden teaser display
Now the teaser shows up as it's overridden by node.tpl.php
Best,
Andrey.
Comment #7
mr.andrey commentedIt works as long as I rebuild the theme registry on every request, but as soon as that's turned off, I get nothing in the main frame.
Any ideas?
Andrey.
Comment #8
redndahead commentedWon't have any chance of getting to berkeley unfortunately.
Have you tried yourtheme_..... instead of phptemplate_.....? You shouldn't have to reload on every page.
Also Adding the teaser as a field doesn't get themed by node.tpl.php?
Comment #9
mr.andrey commentedNope, it doesn't get themed, that's actually the main problem. If it got themed, I wouldn't have to do any roundabout scripts.
Best,
A.
Comment #10
redndahead commentedI'll try to bug someone at drupalcon about the best way to theme fields. Will see what I get.
Comment #11
mr.andrey commentedJust tried renaming to themename_ instead of phptemplate_, no luck. First refresh after rebuilding theme registry it works, but every following reload the main frame is empty.
A.
Comment #12
redndahead commentedOk reading what you did again is there a reason why you didn't just add the teaser field and then use the views theming to override the teaser field? I checked using tpl.php for fields added with views and it worked fine. You can find the tpl.php file suggestions at the bottom of basic settings in the views settings.
Comment #13
mr.andrey commentedIs that very different from what I did before?
I just tried what you suggested though, and had overridden the teaser field with views-view-field--viewname--teaser.tpl.php. And it seems to have the same problem - when the registry is not rebuilt on every page, the teaser is empty.
Even if I use as simple override as "echo '123';" the main frame still comes blank.
The interesting thing is that if I put in dpm($row) into the tpl override, all the data is still there. It's only the display that's not working.
Any ideas on how to further troubleshoot this?
Andrey.
Comment #14
intyms commentedon my side, everything is working well.
try to test this with a fresh copy of drupal, views and views slideshow (use latest dev).
Comment #15
mr.andrey commentedI think this may have to do with #591804: Theme registry build bug: External file with template_preprocess is not loaded if tpl.php is copied into theme.
I'll upgrade Drupal and report back.
Thanks,
Andrey.
Comment #16
mr.andrey commentedYep, that was it. All works now as expected after upgrading Drupal to 6.16.
I ended up using views-view-field--viewname--nid.tpl.php with the following to get the normal tpl-themed teaser:
You can see the live site here: http://www.lulubandhas.com
Thanks,
Andrey.
Comment #17
redndahead commentedmarking as fixed.
Comment #18
rovoI think I am experiencing the same issue. I've created a custom views template, but it will only work in SingleFrame mode. Thumbnail Hover ignores the custom view template.
This is the Row Style template I made: views-view-fields--block-1.tpl.php
Is this the same issue?
I've upgraded to the latest view slideshow...
6.x-2.x-dev Download (262.95 KB) 2010-Apr-28
Should I be using 6.x-3.x-dev even though it is older?
thank you
Comment #19
rovoThis does not seem fixed to me. Maybe there is something more I need to do... just marking for review.
Thanks
Comment #20
redndahead commented@rob_dean
Rows are themed using theme functions which you can find in views_slideshow_thumbnailhover.theme.inc or views_slideshow_singleframe.theme.inc. It's certainly not the easiest way to theme it and in 3.x, which is only for users of views 3, this will completely change. For now you will need to copy out
function theme_views_slideshow_singleframe_no_display_section($view, $rows, $id, $mode) {....
and put it in your template.php file in your theme. It will need to be named:
function your_theme_views_slideshow_singleframe_no_display_section($view, $rows, $id, $mode) {....
You will need to make changes inside that function.
Comment #21
rovothanks for the explanation. I think I will wait till I get setup with 3.x
Thanks again for the awesome module.
Comment #22
redndahead commentedComment #23
vicentefoxxx commentedHi
I have some fields that i want to put together in a div so i can style all of them with css. That is why i override my views-view-fields.tpl.php with a views-view-fields--nameof_the_view.tpl.php inside my theme folder. And it is working with all my styles except Views slideshow, when i select Views slideshow as my display, my customized views-view-fields is ignored. And i am getting all my fields rendered as usual with out the div.
Does some of you know how to change this?
I am using slideshow with thumbnailhover.
Thanks for the help
Comment #24
intyms commentedto #23
vicentefoxxx
you can put your fields in a div using "Global: Custom text" field.
Comment #25
redndahead commentedYou can look at this video to see how to utilize Global: Custom text http://mustardseedmedia.com/podcast/episode42
In thumbnailhover you will need to exclude the fields that are in your custom text and you will need to check the boxes to include those fields in the slideshow. I will have a patch in a future release that will make this not necessary.