need help to get shadowbox to render correctly in page source
playwithtoy - September 25, 2009 - 21:36
| Project: | Shadowbox |
| Version: | 6.x-3.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed (maintainer needs more info) |
Jump to:
Description
hey all
im trying to get an image to popup in shadowbox on my test page
ive found one of the diffs is that a css file is missing in the header
(which ive opened in a different post)
and the other problem is this
shadowbox doesnt init
so on the page in shadowbox admin where shadowbox does work
the last few lines of codes on the bottom of the page source looks like this
<script type="text/javascript" src="/modules/shadowbox/shadowbox_auto.js?g"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
Shadowbox.init(Drupal.settings.shadowbox);
//--><!]]>
</script>my test page doesnt have this
is there something im not checking off in admin
that prevents the above code from rendering in my test pages page source?
thanks for your help
toy

#1
hey all - this is def the issue since i just manually put the init in my php content box
and it worked
now how can i get the init to automatically inject?
#2
ok after a little more snooping around
i found shadowbox_construct_header() in shadowbox.module
it looks like this
function shadowbox_construct_header() {
global $language;
$module_path = drupal_get_path('module', 'shadowbox');
$shadowbox_path = SHADOWBOX_DEFAULT_PATH;
$shadowbox_location = variable_get('shadowbox_location', $shadowbox_path);
$images = variable_get('shadowbox_supported_images', shadowbox_get_types('image'));
$swf = variable_get('shadowbox_supported_swf', shadowbox_get_types('swf'));
$flv = variable_get('shadowbox_supported_flv', shadowbox_get_types('flv'));
$quicktime = variable_get('shadowbox_supported_quicktime', shadowbox_get_types('quicktime'));
$wmp = variable_get('shadowbox_supported_wmp', shadowbox_get_types('wmp'));
$qtwmp = variable_get('shadowbox_supported_qtwmp', shadowbox_get_types('qtwmp'));
$iframe = variable_get('shadowbox_supported_iframe', shadowbox_get_types('iframe'));
$image_support = array_filter($images);
$swf_support = array_filter($swf);
$flv_support = array_filter($flv);
$quicktime_support = array_filter($quicktime);
$wmp_support = array_filter($wmp);
$qtwmp_support = array_filter($qtwmp);
$iframe_support = array_filter($iframe);
if (shadowbox_active() && variable_get('shadowbox_enabled', TRUE)) {
// Add the base files.
drupal_add_js($shadowbox_location .'/shadowbox.js');
drupal_add_js($shadowbox_location .'/adapters/shadowbox-jquery.js');
drupal_add_css($shadowbox_location .'/shadowbox.css');
// Add the language file.
$language_file = $shadowbox_location .'/languages/shadowbox-'. $language->language .'.js';
if (file_exists($language_file)) {
drupal_add_js($language_file);
}
else {
// If a language file doesn't exist, default to English.
drupal_add_js($shadowbox_location .'/languages/shadowbox-en.js');
}
// Add the "player" files.
if (!empty($image_support)) {
drupal_add_js($shadowbox_location .'/players/shadowbox-img.js');
}
if (!empty($swf_support)) {
drupal_add_js($shadowbox_location .'/players/shadowbox-swf.js');
}
if (!empty($flv_support)) {
drupal_add_js($shadowbox_location .'/players/shadowbox-flv.js');
}
if (!empty($quicktime_support)) {
drupal_add_js($shadowbox_location .'/players/shadowbox-qt.js');
}
if ((!empty($wmp_support)) || (!empty($qtwmp_support))) {
drupal_add_js($shadowbox_location .'/players/shadowbox-wmp.js');
}
if (!empty($iframe_support)) {
drupal_add_js($shadowbox_location .'/players/shadowbox-html.js');
drupal_add_js($shadowbox_location .'/players/shadowbox-iframe.js');
}
// Print the JavaScript settings to the page.
drupal_add_js(shadowbox_get_settings(), 'setting');
// Add the automatic image handling.
drupal_add_js($module_path .'/shadowbox_auto.js', 'module', 'footer'); <--here
print ($module_path .'/shadowbox_auto.css'); <-- this prints out exactly what im expecting
// [toy] added the missing css file - why wasnt this here in the first place??
drupal_add_css($module_path .'/shadowbox.css');
// Initialize Shadowbox.
drupal_add_js('Shadowbox.init(Drupal.settings.shadowbox);', 'inline', 'footer'); <-- here
}
// Special case for the admin settings page test.
if ($_GET['q'] == 'admin/settings/shadowbox'
|| $_GET['q'] == 'admin/settings/shadowbox/global') {
drupal_add_css($module_path .'/shadowbox.css');
}
}
so basically the code is there to add missing lines
but for some reason its not outputing to the page source correctly
any ideas?
thanks!
toy
#3
I don't really know what it could be. Must be something specific to your setup as it's working for others.
#4
yeah i think its my configuration
cause ive installed another module (finder)
and it also is not injecting fully