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

Anonymous’s picture

The settings seems to be added in only one spot:

inside template_preprocess_views_slideshow_singleframe(),

drupal_add_js(array('viewsSlideshowSingleFrame' => array('#views_slideshow_singleframe_main_' . $vss_id => $settings)), 'setting');

Apparently this function is not always fired. I'm using a view block.

Anonymous’s picture

Version: 6.x-2.x-dev » 6.x-3.x-dev

Also in 6x-3x... This happens after a while, after a few days. Somehow the Drupal.settings.viewsSlideshowSingleFrame just disappears...

markgukov’s picture

Version: 6.x-3.x-dev » 6.x-2.3

Experiencing the same problem. The slideshow is only displayed once right after flushing caches.

redndahead’s picture

Status: Active » Postponed (maintainer needs more info)

Not 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?

hefox’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new2.97 KB

If 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.

Anonymous’s picture

That's some pretty smart thinking. I think it solved my issue, haven't seen the JS crash anymore.

hefox’s picture

There'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

gagarine’s picture

#7 works for me thanks

redndahead’s picture

I'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?

hefox’s picture

I 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

lindsayo’s picture

I'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.

samdds’s picture

I have this error only on my front page :/

mdm’s picture

This 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:

$featured_view = views_get_view('frontpage_featured');
print $featured_view->execute_display('default', $args);

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:

patch --verbose -p0 < 893428_views_slideshow_advanced_issues_0.patch

in the module's root folder. It complained:

patch: **** malformed patch at line 86:    // to the id to make it unique.
hefox’s picture

Status: Needs review » Needs work
mdm’s picture

Okay, 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:

drupal_add_js(array('viewsSlideshowSingleFrame' => array('#views_slideshow_singleframe_main_' . $vss_id => $settings)), 'setting');

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.

redndahead’s picture

@mdm have you followed the instructions here: http://drupal.org/node/823056

mdm’s picture

@redndahead That solved my issue and taught me something new about Drupal, thanks! :)

hefox’s picture

(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. )

fureigh’s picture

Any chance of re-rolling the patch? So close... :)

fureigh’s picture

@hefox: Whoops, sorry — left the page open too long before posting that comment.

hefox’s picture

StatusFileSize
new2.4 KB

Apparently 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.

sydneyshan’s picture

From what I can tell turning off caching for the Views Slideshow Block works a treat.

hefox’s picture

Status: Needs work » Needs review
zvischutz’s picture

#5 worked for me, Many thanks

henrijs.seso’s picture

Status: Needs review » Reviewed & tested by the community

Awesome! 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.

henrijs.seso’s picture

and 3.x -dev probably needs same fixes...

redndahead’s picture

3.x won't need it as it handles advanced options in a complete different way.

redndahead’s picture

Status: Reviewed & tested by the community » Fixed

this has been committed. Thank you

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

john777’s picture

i 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?

redndahead’s picture

If you haven't you should be using the dev version.

john777’s picture

Thank 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

MMusashi’s picture

Title: Drupal.settings.viewsSlideshowSingleframe is undefined » If you're using "row style: fields"

Then edit your field in the view and clear the checkbox for "Group multiple values".
worked for me.

diego.banchero’s picture

This #22 works for me.

Thanks.

mihaizs’s picture

I'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.

Drupal webdesigner’s picture

Thanks 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.

cyprien2’s picture

The patch #21 doesn't work for me.
Any issue about that ?

reubenavery’s picture

I 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.