Suggestion (more a plea..) for the Lightbox plugin

Creating and modifying plugins.
Mangek
Regular
Posts: 85
Joined: Tue Jun 24, 2008 1:08 am
Location: Sweden
Contact:

Suggestion (more a plea..) for the Lightbox plugin

Post by Mangek »

Hey guys,

I'm using the Lightbox plugin to post some images in a Gallery-like manner and I'm starting to miss the rel='lightbox[groupname]' feature.

I've tried adding that bit by hand, and it's grouping the images, but it still spits out a second rel='lightbox' which probably will break something somewhere at some point. ;)

Would it be easy to edit the plugin to have it add [groupname] automatically? I tried adding that in a single-image entry and the arrows wouldn't appear, so that would work fine for me.

And a following question, could I somehow use the name of the entry as the group (or something equally diversing)? So that they don't 'all' group together, only from the same entry.

I tried editing serendipity_event_lightbox.php, but realised, as it's .php, that I couldn't just insert the smarty tags to include the entry title.

Any help would be appreciated. (And rewarded with e-cookies!) :)
Mangek
Regular
Posts: 85
Joined: Tue Jun 24, 2008 1:08 am
Location: Sweden
Contact:

Post by Mangek »

Any suggestions? Before I break something, going in over my head.. :D
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Usually, $eventData should be available within the entry plugin hook to be used in PHP code...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Mangek
Regular
Posts: 85
Joined: Tue Jun 24, 2008 1:08 am
Location: Sweden
Contact:

Post by Mangek »

Thanks for the reply Garvin! unfortunately I don't know where to begin, or what to do. :oops:

I did a search, and found this function in the above mentioned file:

Code: Select all

function event_hook($event, &$bag, &$eventData) {
and below that

Code: Select all

if ($regex == null) {
                if ($type == 'lightbox' || $type == 'lightbox_plus' || $type == 'lightbox2') {
                    $regex = '/<a([^>]+)(href=(["\'])[^"\']*\.(jpe?g|gif|png)["\'])/i';
                    $sub   = '<a $1 rel=$3lightbox$3 $2';
                } elseif ($type == 'thickbox') {
					~ code stripped ~
                }
            }
This is where I'm stuck. I don't know what to add to rel=$3lightbox$3 to group it individually for entries, as smarty won't work. My PHP skills don't go much further than your average 'Hello World'... :roll:
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Sadly I don't use the lightbox plugin, so I am also not familiar with the code, and currently have no time to look into this.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
DwB
Regular
Posts: 32
Joined: Fri Feb 10, 2006 11:06 am
Contact:

Post by DwB »

Mangek: try using "Gallery with photos of the entry" in the configuration of the plugin.
Mangek
Regular
Posts: 85
Joined: Tue Jun 24, 2008 1:08 am
Location: Sweden
Contact:

Post by Mangek »

DwB wrote:Mangek: try using "Gallery with photos of the entry" in the configuration of the plugin.
Hm I don't see that. I'm using an older version of the plugin (had some troubles with the recent one). I'll see about fixing an updated version.

If I can do it from within the plugin that would be great. :)
DwB
Regular
Posts: 32
Joined: Fri Feb 10, 2006 11:06 am
Contact:

Post by DwB »

I was able to create a kind of slide-show within an entry contaiining 2 pictures using this setting.
I'm using the latest version coming from spartacus, perhaps that's the problem witz your blog.
Mangek
Regular
Posts: 85
Joined: Tue Jun 24, 2008 1:08 am
Location: Sweden
Contact:

Post by Mangek »

Yep, encountering the same problem I had last time I tried the recent version. Take a look here. The script breaks, for some reason. :?

Edit: I want to use Lightbox 2, but that's what breaks. Lightbox 1 and Greybox won't load at all. Lightbox Plus and Thickbox both run, but they look ugly.. Could this be a setting on my host's end? :?
DwB
Regular
Posts: 32
Joined: Fri Feb 10, 2006 11:06 am
Contact:

Post by DwB »

Okay, I use lightbox_plus, since the others don't work correctly on my blog...
Mangek
Regular
Posts: 85
Joined: Tue Jun 24, 2008 1:08 am
Location: Sweden
Contact:

Post by Mangek »

Ok, with a bit of hacking the versions together (adding the new serendipity_event_lightbox.php to the old install) I finally got it to work properly.

Don't know what's causing it not to work with a proper fresh install, but this will do.

Thanks for the help and suggestions, Garvin and DwB. Sent me on the right way. :)
ed587
Regular
Posts: 75
Joined: Thu Feb 12, 2009 3:26 pm

Re: Suggestion (more a plea..) for the Lightbox plugin

Post by ed587 »

Anyone have new words on how to get lightbox2 to work? It sounds from what is written above I should try to get an earlier version of lightbox and then just add the serendipity_event_lightbox.php to it?

If this is the case, where would I find the earlier version of lightbox plugin?

I had a server error 500 yesterday and had to do a reinstall, lightbox2 now doesn't work. I have deleted and reinstalled twice.

Any help will be wonderful. Thanks.

The best,
~Ed587
The best,

~Ed
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Suggestion (more a plea..) for the Lightbox plugin

Post by garvinhicking »

Hi ed587!

What's your URL of an entry that should contain a lightbox image?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
ed587
Regular
Posts: 75
Joined: Thu Feb 12, 2009 3:26 pm

Re: Suggestion (more a plea..) for the Lightbox plugin

Post by ed587 »

garvinhicking wrote:Hi ed587!

What's your URL of an entry that should contain a lightbox image?

Regards,
Garvin
Hello Garvin,

The first entry of the first page is one. http://www.neterm.net/serendipity

~Ed587
The best,

~Ed
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Suggestion (more a plea..) for the Lightbox plugin

Post by garvinhicking »

Hi!

When I call http://www.neterm.net/serendipity/plugi ... ototype.js I get a permission denied error. Is the path right? Check the file/directory permissions?!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply