Piclens script not automatically included

levavie - June 11, 2008 - 16:20
Project:Cooliris (PicLens formerly)
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

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

swentel - June 12, 2008 - 16:07

I can confirm the bug with the zen theme. I'll look into why drupal_set_content() doesn't do it's job.

#2

swentel - June 12, 2008 - 16:54
Status:needs work» fixed

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

swentel - June 12, 2008 - 16:55
Status:fixed» closed

#4

levavie - June 14, 2008 - 22:52
Status:closed» active

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

swentel - June 16, 2008 - 16:13

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

bwynants - June 16, 2008 - 19:36

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

swentel - June 20, 2008 - 15:39

@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

bwynants - June 23, 2008 - 10:45

@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

swentel - July 2, 2008 - 16:21
Status:active» closed

Local dev tests with drupal_set_html_head (instead of drupal_set_content) seem to work fine. Marking as closed for now.

 
 

Drupal is a registered trademark of Dries Buytaert.