I frequently get this error in Firebug:
Drupal.settings.viewsSlideshowSingleframe is undefined
Slideshow doesn't work. Looking at the html page, indeed the setting is undefined:
<!--//--><![CDATA[//><!--
jQuery.extend(Drupal.settings, { "basePath": "/", "googleanalytics": { "trackOutgoing": 1, "trackMailto": 1, "trackDownload": 1, "trackDownloadExtensions": "7z|aac|avi|csv|doc|exe|flv|gif|gz|jpe?g|js|mp(3|4|e?g)|mov|pdf|phps|png|ppt|rar|sit|tar|torrent|txt|wma|wmv|xls|xml|zip" }, "nice_menus_options": { "delay": "800", "speed": "fast" } });
//--><!]]>
It seems to be a cache issue, because after refreshing cache it works fine again.
This is at the bottom of the page in $closure:
<!--//--><![CDATA[//><!--
jQuery.extend(Drupal.settings, { "pathToTheme": "sites/all/themes/start" });
//--><!]]>
<!--//--><![CDATA[//><!--
jQuery.extend(Drupal.settings, { "CToolsAJAX": { "scripts": { "/sites/all/modules/contrib/jquery_update/replace/jquery.min.js?c": true, "/misc/drupal.js?c": true, "/sites/default/files/languages/ar_3accd1c5399bd159303f1f02a1ec762f.js?c": true, "/sites/all/modules/contrib/nice_menus/superfish/js/superfish.js?c": true, "/sites/all/modules/contrib/nice_menus/superfish/js/jquery.bgiframe.min.js?c": true, "/sites/all/modules/contrib/nice_menus/superfish/js/jquery.hoverIntent.minified.js?c": true, "/sites/all/modules/contrib/nice_menus/nice_menus.js?c": true, "/sites/all/modules/contrib/panels/js/panels.js?c": true, "/sites/all/modules/contrib/swftools/shared/swfobject2/swfobject.js?c": true, "/sites/all/modules/contrib/views_slideshow/js/jquery.cycle.all.min.js?c": true, "/sites/all/modules/contrib/views_slideshow/contrib/views_slideshow_singleframe/views_slideshow.js?c": true, "/sites/all/modules/contrib/google_analytics/googleanalytics.js?c": true }, "css": { "/modules/node/node.css?c": true, "/modules/node/node-rtl.css?c": true, "/modules/poll/poll.css?c": true, "/modules/poll/poll-rtl.css?c": true, "/modules/system/defaults.css?c": true, "/modules/system/defaults-rtl.css?c": true, "/modules/system/system.css?c": true, "/modules/system/system-rtl.css?c": true, "/modules/system/system-menus.css?c": true, "/modules/system/system-menus-rtl.css?c": true, "/modules/user/user.css?c": true, "/modules/user/user-rtl.css?c": true, "/sites/all/modules/contrib/cck/theme/content-module.css?c": true, "/sites/all/modules/contrib/cck/theme/content-module-rtl.css?c": true, "/sites/all/modules/contrib/ctools/css/ctools.css?c": true, "/sites/all/modules/contrib/date/date.css?c": true, "/sites/all/modules/contrib/date/date-rtl.css?c": true, "/sites/all/modules/contrib/filefield/filefield.css?c": true, "/sites/all/modules/contrib/filefield/filefield-rtl.css?c": true, "/sites/all/modules/contrib/itweak_upload/itweak_upload.css?c": true, "/sites/all/modules/contrib/nice_menus/nice_menus.css?c": true, "/sites/all/themes/start/css/nice_menus_default-rtl.css?c": true, "/sites/all/modules/contrib/panels/css/panels.css?c": true, "/sites/all/modules/contrib/video/types/uploadfield/uploadfield.css?c": true, "/sites/all/modules/contrib/views_slideshow/contrib/views_slideshow_singleframe/views_slideshow.css?c": true, "/sites/all/modules/contrib/cck/modules/fieldgroup/fieldgroup.css?c": true, "/sites/all/modules/contrib/cck/modules/fieldgroup/fieldgroup-rtl.css?c": true, "/sites/all/modules/contrib/views/css/views.css?c": true, "/sites/all/modules/contrib/views/css/views-rtl.css?c": true, "/sites/all/modules/contrib/faq/faq.css?c": true, "/sites/all/themes/start/css/drupal6-reference.css?c": true, "/sites/all/themes/start/style.css?c": true, "/sites/all/themes/start/css/clears.css?c": true, "/sites/all/themes/start/css/print.css?c": true } } });
//--><!]]>
Comments
Comment #1
Anonymous (not verified) commentedThe settings seems to be added in only one spot:
inside template_preprocess_views_slideshow_singleframe(),
Apparently this function is not always fired. I'm using a view block.
Comment #2
Anonymous (not verified) commentedAlso in 6x-3x... This happens after a while, after a few days. Somehow the Drupal.settings.viewsSlideshowSingleFrame just disappears...
Comment #3
markgukov commentedExperiencing the same problem. The slideshow is only displayed once right after flushing caches.
Comment #4
redndahead commentedNot sure why this would happen. Just to make sure I wasn't doing anything weird I checked views_cycle and views_rotator modules and they add the settings in the same exact place. So not sure why it's not working. Would need to figure out in what cases does template_preprocess_ not get fired, but the page is rebuilt. Are you using panels or anything special?
Comment #5
hefox commentedIf the view is added via ajax, but the settings aren't (which is, unfortunally, quite useful with ajax), it errors out due to undefined index -- ie views preview, context ui drag and drop. Then usually breaks the rest of the ajax on the page, caused a enternal error loop for me somehow, was up to 2k js errors >.O
Reproduce: use views preview on the view.
It's cause the files are added to every single page, but the settings only as needed, so if the html with the classes it recongizes get added, it tries looking for the corresponding settings, and bam, js error.
Patch attached only add settings when js settings is added.
Comment #6
Anonymous (not verified) commentedThat's some pretty smart thinking. I think it solved my issue, haven't seen the JS crash anymore.
Comment #7
hefox commentedThere's another issue when the setting is set and it does not recongize it as a string; also need to do it for the other submodule that has the same issues
Comment #8
gagarine commented#7 works for me thanks
Comment #9
redndahead commentedI'll try to look at this as soon as I can. I believe it was moved to init because if you cached the views it wouldn't work. Does this allow the view to be cached and still work?
Comment #10
hefox commentedI haven't tested all caching, but with views caching it appears to be working with what caching we have enabled; I'm not sure what step in the process views caches the javascript file/settings but it appears to they are cached
Comment #11
lindsayo commentedI'm still getting this error, even with running the patch in #7.
Firebug reports it to be on line 15 of views_slideshow.js:
settings.targetId = '#' + $(fullId + " :first").attr('id');
This is what fb says in the scopechain:
[Call { fullId="#views_slideshow_singleframe_main_1"}, Call { context=}, Window node]
This is a screengrab of my fb session: http://grab.by/6G3P
****
Edit: I downgraded Views Slideshow to version 2.0 and now it works fine.
Comment #12
samdds commentedI have this error only on my front page :/
Comment #13
mdm commentedThis is happening on my frontpage only. If I go to the page display for my view, the slideshow works fine. I'm adding it to the frontpage template like this:
and I get the same message as OP: viewsSlideshowSingleFrame is undefined. I stepped through the page load in NetBeans and far as I can tell, it's adding the viewsSlideshowSingleFrame variable to Drupal.settings. I applied #5 above, which broke my slideshow (all images appeared inline). I applied #7 by doing:
in the module's root folder. It complained:
Comment #14
hefox commentedComment #15
mdm commentedOkay, so I've done some more hacking around on this and have come to the end of my Drupal knowlege. I can see that during page load for my frontpage, this line is executed:
and it appears to work. viewsSlideshowSingleFrame is added to $javascript['settings'] in drupal_add_js(). But somewhere between there and the page load finishing, that variable is not added to Drupal.settings. I'm not sure where to look next.
Comment #16
redndahead commented@mdm have you followed the instructions here: http://drupal.org/node/823056
Comment #17
mdm commented@redndahead That solved my issue and taught me something new about Drupal, thanks! :)
Comment #18
hefox commented(I was thinking about it again, and think the file should also check for viewsslideshowsingelframe being defined, and not rely on the file only being included as needed; was thinking of the different situations and, while ideally the settings would always be there when the html is, there's too many chances, considering ajax that would not be so. Going to leave this needs work till can update the patch, and make sure it actually applies via patch and not manually. )
Comment #19
fureigh commentedAny chance of re-rolling the patch? So close... :)
Comment #20
fureigh commented@hefox: Whoops, sorry — left the page open too long before posting that comment.
Comment #21
hefox commentedApparently we're still using the 1.x branch >.O, but looks like the 2.x branch still has this issue.
Restored the slideshow js being added in init*, but added the checks mentioned above.
*Views does have an issues with caching files; if a file is added in the first view, it caches that it needs that file; however if another view WOULD have added the file, but don't cause it's added by first, bam, file no be added if second view viewed alone. Technically a views issue, but :/.
#962592: Drupal.settings.viewsSlideshowJCarouselThumbs is undefined for jcarouselthumbd issue.
Comment #22
sydneyshan commentedFrom what I can tell turning off caching for the Views Slideshow Block works a treat.
Comment #23
hefox commentedComment #24
zvischutz commented#5 worked for me, Many thanks
Comment #25
henrijs.seso commentedAwesome! These patches fixed some other issue - you could not drag and drop Views Slideshow block with Context UI/Admin modules. I went nuts! It just showed block for split second and then it was gone. Now it works as expected. Thank you hefox and others!
Also I didn't find any problems so far, so changing status.
Comment #26
henrijs.seso commentedand 3.x -dev probably needs same fixes...
Comment #27
redndahead commented3.x won't need it as it handles advanced options in a complete different way.
Comment #28
redndahead commentedthis has been committed. Thank you
Comment #30
john777 commentedi have also this kind of problem "settings is undefined" appear in my firebug in javascript error, my views slideshow does not display correctly paused in the last content i made in that views. When i login as user1 it goes well as it should what i notice is all on my site uses a javascript does not work properly even my navigation menu, wibiya and the views. I am a newbie, if i use this patch 893428_slideshow_undefined.patch where should i paste it?
Comment #31
redndahead commentedIf you haven't you should be using the dev version.
Comment #32
john777 commentedThank you rednahead, i have already installed the dev version and it works only one thing does not have the thumbnail feature like on the recomended version, but anyway the important is now working, again thank you
John Gorospe
Comment #33
MMusashi commentedThen edit your field in the view and clear the checkbox for "Group multiple values".
worked for me.
Comment #34
diego.banchero commentedThis #22 works for me.
Thanks.
Comment #35
mihaizs commentedI've come on this situation only after using the slideshow in at least 10 sites, where it worked perfectly. Analyzing the differences, I've realised that this situation occurs only when you embed the slideshow in the page.tpl.php template file.
If you create a special type for the home page and the home page is of this type, the slideshow is embedded at node.tlp.php level and this problem does not occur...
Also, the solution described at #16 worked for me in embedding the slideshow at page.tpl.php level.
Thank you.
Comment #36
Drupal webdesigner commentedThanks for the tip, i also used a print function to get my views blocks on screen, i was stuck on a other project with this. Now my second project has it to, but the projects before didn't. Like you say, because the you have to use the blocks regions.
Comment #37
cyprien2 commentedThe patch #21 doesn't work for me.
Any issue about that ?
Comment #38
reubenavery commentedI was hitting this problem as well, but I was not using views_embed_views within page.tpl.php.
What my problem was is that within the view itself I had caching turned on "per user". I flipped this off (am using Drupal's block caching anyway, and my slideshow is a block, along with normal page caching) and things seem to be fine now.