sfLightboxPlugin - 1.0.4

Lightbox2 plugin for Symfony

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to the Plugins Home


Forgot your password?
Create an account



advanced search
Information Readme Releases Changelog Contribute
Show source | Show as Markdown


sfLightboxPlugin is a symfony plugin that provides an easy to use wrapper for the Lightbox2 javascript library.

It add a new helper : LightboxHelper with 3 functions : * light_image, to display an image * light_slideshow, to display a slideshow * light_modalbox, to display a modal popup with any content


  • Install the plugin

    symfony plugin-install http://plugins.symfony-project.com/sfLightboxPlugin

    (or download it at the root of your project and install locally : symfony plugin-install sfLightboxPlugin-x.x.x.tgz)

  • If you don't want to use the following data structure :

    • /sfLightboxPlugin/js/

    • /sfLightboxPlugin/lightbox/

    • /sfLightboxPlugin/lightbox/

    You will have to modifiy the path in 'lightbox.css', 'lightbox.js', 'modalbox.js' and the 'config.php' of the plugin (or make your own in your application by creating a sfLightboxPlugin module) You also have a french picture for the close button in '/web/images/fr/', you will also have to change the path if you want to use it for now.

  • Clear you cache

    symfony cc


  • 1 - To display one image

    'Lightbox2 Taz image !'); echo light_image('logo.jpg', 'taz.jpg', $image_options); ?>
  • 2 - To display a slide show of several images

    'taz.jpg', 'image' => 'taz2.jpg', 'options' => array('title' => 'taz2') ); $images[] = array( 'thumbnail' => 'taz2.jpg', 'image' => 'logo.jpg', 'options' => array('title' => 'Taz') ); $images[] = array( 'thumbnail' => 'logo.jpg', 'image' => 'taz.jpg', 'options' => array('title' => 'Taz') ); $link_options = array( 'title' => 'Taz SlideShow', 'slidename' => 'taz', ); echo light_slideshow($images, $link_options) ?>
  • 3 - To display a modal box with content of the result of an action

    // Modal Lightbox plugin test $link_options = array( 'title' => 'Taz...', 'class' => 'blocksize_800x700' );
    // or $link_options='title="Taz..." size=800x700 speed=5';

    echo light_modallink('

Taz presentation

', 'index/presentation', $link_options);

You can change the class to adjust the wanted size. Of course you can use a route instead of a 'module/action'. Don't forget to disable the layout as it's as if you were in a popup.

  • That's all, ;)



  • LightboxHelper.php : When creating a slideshow the caption of the images are now taken from the title attribute of each images if it exists whereas it is taken from the title attribute of the link if not (before it was always taken from the title link attribute)


  • modalbox.js now allows to call initModalbox several times (in case a modal link is created dynamically, after page load). Don't forget to call initModalbox() again when you create a new modal link.
  • config.php : corrected wrong paths stored in config


  • Helpers enhancements options are now parsed so they can be scalar or array, just like the link_to helper light_modallink : added 'speed' and 'size' options (using regular classes is still allowed to keep BC)
  • modalbox.js fixes : removed some unused, unitialized variables that could cause JS errors in IE6 in some cases.
  • File structure changes : Removed the 'lightbox' folder in web/css, web/js and web/images Prepared for next release in web/images, as closelabel.gif will be culture-dependent


  • Some bug fixes in modalbox.js and also modalbox.css which affected IE6/7 and Opera.
  • Renaiming of some html identifiers in modalbox to allow use of modalbox and lightbox in the same document. (more info in modalbox.js file)
  • Modified default close image from 'closelabel.gif' which was culture dependent to 'close.gif' (only a close cross).


  • First version