Piclens script not automatically included
| Project: | Cooliris (PicLens formerly) |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
The following happens with both the 5.x-1.5 and the 5.x-dev versions, when trying to start the piclens slideshow on an image gallery.
This is a PHP issue - I've checked that PHP execution reached mediarssapi_piclens_lite_javascript() but somehow, the piclens script was not included (even thought I'm using a standard zen-based phptemplate theme).
When I've manually included the script on the section - everything worked fine.
(The script must be included at the top of page - putting it on the bottom for performance optimization caused errors with IE7).
Sample code:
<?php if (arg(0)=='image') { /* Piclens script must be included on top for IE compatibility */ ?>
<script type="text/javascript" src="http://lite.piclens.com/current/piclens_optimized.js"></script>
<?php } ?>Amnon
-
Professional: Drupal Israel | Drupal Development & Consulting | Eco-Healing
Personal: Hitech Dolphin: Regain Simple Joy :)

#1
I can confirm the bug with the zen theme. I'll look into why drupal_set_content() doesn't do it's job.
#2
Ok, I knew this might come after me one day. I default trie to add the javascript into the content region which is a default region in the garland theme. Zen based themes however do not have this, instead they use content_top, content_bottom. The piclens module now has a configuration option to change the region where the javascript should be included.
Commited to drupal 5 branch.
Thanks for the report!
#3
#4
No, changing the region name doesn't change anything.
The script must still be added manualy.
My theme is a sub-theme of an old Zen theme, a year old.
I would be glad if someone else verify that the new Zen works indeed.
#5
Can you look into template.php and look for the function theme_classic_regions() function to see which regions are defined ?
I did tests with the latest zen theme (http://drupal.org/project/zen) and latest development snapshot of piclens and got the javascript inclusion working everywhere.
Can you otherwhise provide a tar from your theme so I can test it myself locally ?
#6
I use this:
$script .= 'document.write(unescape("%3Cscript src=\'http://lite.piclens.com/current/piclens_optimized.js\' type=\'text/javascript\'%3E%3C/script%3E"));';drupal_add_js($script, 'inline');
It works just fine....even in a tpl override....
#7
@levavie : next built of dev uses drupal_set_html_head again, it seems that jquery doesn't break anymore, let me know if it works for you.
@bwynants: cool code. I went to your site also, but the javascript wasn't included when I went to one of the image galleries. I got errors when clicking on the slideshow link.
#8
@swentel: yeah, site was no longer using that code after I updated to latest (dev) piclens 'content' code. seems it dit not worked 100%.... back to my code injected from within the theme template overrides since sunday....
#9
Local dev tests with drupal_set_html_head (instead of drupal_set_content) seem to work fine. Marking as closed for now.