adding jquery lightbox on images

Please post all install related problems here. Visit this forum first for troubleshooting.
Post Reply
rbrickyboy
Posts: 7
Joined: Wed 22. Aug 2012, 17:35

adding jquery lightbox on images

Post by rbrickyboy » Thu 23. Aug 2012, 17:02

Hi all,
I am trying to add jquery lightbox on all images uploaded on a certain page,
how could I able to modify the template so I could append the class / id to the image or to its <a> tag.

Thanks

User avatar
Oliver Georgi
Site Admin
Posts: 9560
Joined: Fri 3. Oct 2003, 22:22
Location: Moscow, Russia
Contact:

Re: adding jquery lightbox on images

Post by Oliver Georgi » Sun 26. Aug 2012, 09:59

Use the following in your template (maybe the Content Part’s one holding the images, untested):

Code: Select all

<!-- INIT_LIGHTBOX -->
Put the following code snippet (maybe name it lightbox.php) in your template/inc_script/frontend_render:

Code: Select all

<?php
if(strpos($content['all'], 'INIT_LIGHTBOX')) {
    initSlimbox();
}
?>
Your image template should look like this:

Code: Select all

<a href="%large-image-source%" rel="lightbox"><img = src="%thumbnail-image-source%" /></a>
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон

Post Reply