Agile Web Application Development with Yii 1.1 and PHP5I am currently developing a site for a real estate business and it is all built with Yii Framework -I am alone here so I need the best allies for this job . During this development I come up with the creation of some cool extensions that I am, of couse, going to share with all of you.
This extension is making use of the grrrreat jQuery plugin called PrettyPhoto. Here is its description in detail:
rettyPhoto is a jQuery lightbox clone. Not only does it support images, it also support for videos, flash, YouTube, iframes. It’s a full blown media lightbox.
It is very easy to setup, yet very flexible if you want to customize it a bit. Plus the script is compatible in every major browser, even IE6.
It also comes with useful APIs so prettyPhoto can be launched from nearly anywhere (yes, that includes Flash)!
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:
</p> Yii::import('ext.jqPrettyPhoto'); 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:
</p> <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.
** If you have problems please use this link.
download: jqPrettyPhoto Yii Extension (72.29KB)