jqprettyphoto Integrates lightbox-like pretty photo jQuery plugin

  1. ChangeLog
  2. Requirements
  3. Usage
  4. Update

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

![Snapshot](http://www.yiiframework.com/extension/jqprettyphoto/files/snapshot.png "jqPrettyPhoto")

ChangeLog

Tuesday-01-02-2011

  • Fixed bug when using static method addPretty (thanks guil182)

Thursday-30-12-2010

  • Fixed some minor bugs for the Extension Version
  • Updated javascript script (fixed imgSrc undefined bug)

Requirements

This was built with Yii.1.1. I didn't test backwards compatibility.

Usage

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);

Update

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:

[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

17 1
19 followers
4 963 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: User Interface
Developed by: Antonio Ramirez
Created on: Oct 22, 2010
Last updated: 7 years ago

Downloads

show all

Related Extensions