It is so simple to use PrettyPhoto Extension in Yii Framework.
How to Install
Unzip the contents of the downloaded package below and copy its contents into your application’s protected/extensions folder.
How to Use
Once we have move the contents of the zipped file into the extensions folder we are ready to go. Use it at your own will into your views like this:
- jqPrettyPhoto::addPretty(‘.gallery a’,jqPrettyPhoto::PRETTY_GALLERY,jqPrettyPhoto::THEME_FACEBOOK);
Wow! That was easy! Please allow me to explain the addPretty function. It comes with three 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:
- <div class=“gallery”>
- <a href=“URL_TO_IMAGE_TO_OPEN”><img src=“URL_TO_IMAGE_TO_SHOW”/></a>
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.