PHP Speedy and Lightbox

| July 3, 2008 | 2 Comments

I’ve talked before about the excellent PHP Speedy application – both a PHP script for your website or a WordPress plugin. However, as with all apps of this type, it doesn’t always “play ball” with everything.

In this case, I use the Lightbox 2 plugin for WordPress and, well, PHP Speedy has a tendency to break it.

So, having spoke with Leon at Aciddrop, I have the following fixes (this works on the current 1.8.2 version of Lightbox 2).

First of all, find the following line in lightbox.php:

$lightboxscript.= "<script type=\"text/javascript\" src=\"".$lightbox_path."js/scriptaculous.js?load=effects,builder\"></script>\n";

Replace this with:

$lightboxscript.= "<script type=\"text/javascript\" src=\"".$lightbox_path."js/effects.js\"></script>\n";
$lightboxscript.= "<script type=\"text/javascript\" src=\"".$lightbox_path."js/builder.js\"></script>\n";

Next, open up lightbox.js and before any of the code, add the line:

lb_path = "http://www.artiss.co.uk/wp-content/plugins/lightbox-2-wordpress-plugin/lightbox/";

Obviously, you will need to change the path to wherever your lightbox folder is.

And then, as if by magic, all should work. If you find that photos appear but without any buttons, then it’s the second fix (the one to lightbox,js) that fixes this, so look again at this. If the change to lightbox.php doesn’t work then, well, the lightbox won’t work at all (the picture will simply be displayed normally).

Hopefully, this might help someone ;)

0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Tags: , , ,

Category: Web Development, Wordpress

About the Author ()

David is the owner and main author of Artiss.co.uk. By day he's a developer for a well known UK retailer, by night he looks after this site and write WordPress plugins.

Comments (2)

Trackback URL | Comments RSS Feed

  1. dave says:

    well, i just found your post after having the same issue, but new phpspeedy has ignore rules, and using the lightbox2 plugin (as of december 2008), i simply tell phpspeedy to ignore lightbox.js and lightbox.css (and postratings, whcih i’m also using) and it works just fine

    you can see it in action at badzit.com – check the page source, you’ll see the compressed cache script reference while viewing a lightbox in the page – very happy about it!

  2. David says:

    Hi Dave. Yes, I’m aware of the new functionality. However, at least with my method, PHP Speedy will still function with it – with yours you use the benefit of PHP Speedy for that script.

    Of course, it depends whether you want to fiddle around with the code or not! However, since I made the change to the Lightbox script there hasn’t been any upgrades to it, so I’ve not had to make it again since.

Leave a Reply


By submitting a comment here you agree to our comment policy and grant this site a perpetual license to reproduce your words and name/web site in attribution.