This extension is making use of the grrrreat jQuery lightbox type plugin called PrettyPhoto
For an extended explanation of this extension please visit my blog
- Fixed bug when using static method addPretty (thanks guil182)
- Fixed some minor bugs for the Extension Version
This was built with Yii.1.1. I didn't test backwards compatibility.
Copy the unzipped contents of the extension into your application's protected/extensions folder.
// import the extension Yii::import('ext.jqPrettyPhoto'); $options = array( 'slideshow'=>5000, 'autoplay_slideshow'=>false, 'show_title'=>false ); // call addPretty static function jqPrettyPhoto::addPretty('.gallery a',jqPrettyPhoto::PRETTY_GALLERY,jqPrettyPhoto::THEME_FACEBOOK, $options);
I have updated the widget version to the latest of prettyPhoto plugin so now you can use all the options included in the jquery plugin and make use of slide thumbnails and slideshows.
Hope you enjoy!
In case you want to use jqPrettyPhoto as a widget I have included a widget version (I think that is best suited as a widget than as a Yii extension... anyway, I uploaded both). To make use of the widget please unzip its contents and place them into your application/protected/widgets folder and then to use it do:
// make an instance of the widget in your code $pretty = $this->createWidget('widgets.jqPrettyPhoto'); // config options (**NEW UPDATE**) // see the jqPrettyPhoto.php file to get a list of the available options $options = array( 'slideshow'=>5000, 'autoplay_slideshow'=>false, 'show_title'=>false ); // .gallery a, is the images jquery selector! $pretty->addPretty('.gallery a',$pretty::PRETTY_GALLERY,$pretty::THEME_FACEBOOK, $config);
The addPretty function has four parameters:
1) element/s selector: the JQUERY SELECTOR to the links you want to set pretty photo to. In the example above I had the following on the view’s HTML:
<p><div class="gallery"><br /> <a href="URL_TO_IMAGE_TO_OPEN"><img src="URL_TO_IMAGE_TO_SHOW"/></a><br />
2) The second parameter is of the value jqPrettyPhoto::PRETTY_GALLERY or jqPrettyPhoto::PRETTY_SINGLE, which tells the extension whether the selector will be a list of a gallery images or just a single file.
3) The third one is what theme to use -please refer to jqPrettyPhoto.php’s code to see more options on this one.
4) The configuration options