[Extension] jqPrettyPhoto

Well, as my actual projects require the need to create extensions. Here is another one jqPrettyPhoto from the great lightbox-type jquery plugin prettyPhoto.

The extension in www.yiiframework.com is here

Any problems or suggestions here!


I have problem with load gallery. Single file load properly, but when I set attribute jqPrettyPhoto::PRETTY_GALLERY and set selector to list of links to images, there show only preloader…


jqPrettyPhoto::addPretty('#gallery a',jqPrettyPhoto::PRETTY_GALLERY,jqPrettyPhoto::THEME_DARK_SQUARE);

echo '<div id="gallery">';

echo CHtml::link(URL_TO_MY_THUMBNAIL_1, URL_T0_MY_IMAGE_1);

echo CHtml::link(URL_TO_MY_THUMBNAIL_2, URL_T0_MY_IMAGE_2);

echo '</div>';

Works a treat - thanks a lot! I like how non-intrusive it is. ;)

Could you please check the URLs? Do you have firebug? Can you check the XHR communication?

Thanks Jacmoe!

Hmm that doesn´t work fo me, too.

I get hundreds of "itemSrc is undefined" errors in firebug, if I choose gallery.

A single Image… no problem but gallery won´t work.

Any ideas?

When you select a gallery, you gotta make sure that the class name you point the gallery to be is correct. Check the inside code of the plugin, it is just a wrapper to easy the tasks of writing javascript functions for the js plugin.

Please, double check the class name. If you still have problems, please drop the html here and your PHP code to initialize the plugin and we try to help you.

I have got now the same problem and it is a jqPrettyPhoto bug… I try to find out what is going on as the settings are in my opinion correct. I get you updated with it.

Thanks for your feedback

I have just checked and the extension as a COMPONENT doesn’t work as expected WITH GALLERIES, it has a problem even though is the same script. Widget version works with GALLERIES as expected. Please, use WIDGET version until I figure out where is the problem.

Now it works, I have updated the extension Component (not the widget as it works). It was a version bug of jqPrettyPhoto plugin. Also updated the extension so it allows users to include options (as the widget).

Thank you very much for your feedback to make this extension better.



thanks for the quick support.

The plugin now works and the gallery is very useful.



Hi Antonio,

I have a probleme with this extension :

in my view, i add this :



$options = array(





// call addPretty static function

jqPrettyPhoto::addPretty('.gallery a',jqPrettyPhoto::PRETTY_GALLERY,jqPrettyPhoto::THEME_FACEBOOK, $options);

echo '<div id="gallery">';

echo CHtml::link("./images/angelus.jpg", "./images/angelus.jpg");

echo '</div>';


in attachment, i show my project organisation.

And I have this error :

Non-static method jqPrettyPhoto::scriptName() should not be called statically

Thanks a lot for your help

Oops! it is a bug!

Thanks for sharing my friend

Can you change the function scriptName to protected static ? that will solve the issue

Bug fixed, you can now download the updated version: http://www.yiiframework.com/extension/jqprettyphoto/

Thanks again

Really only one Merit a “thanks” and it’s you.

Thanks to spend a lot of time to help the others.


Hey :)

Firt of all… thanks for the component. The single image mode works perfect for me.

But I wonder how to accomplish the gallery mode without having as many links as images?

Trying your example:

echo '<div id="gallery">';

echo CHtml::link(URL_TO_MY_THUMBNAIL_1, URL_T0_MY_IMAGE_1);

echo CHtml::link(URL_TO_MY_THUMBNAIL_2, URL_T0_MY_IMAGE_2);

echo '</div>';

… gives me two images to click on. I’d prefer to have only one appetizer image to click on. Having 50+ images makes it too crowded on my page… did I totally get it wrong?

Thanks in advance


I think you can hide the links with css.

hi , the jqPrettyPhotos light box is not working when i view the second page item…when i click the image, it just go to that image url without lightbox effect.

can you tell me, what i am wrong?


Hi. Can you post the resulting HTML code containing the images?

Hi Bennouna, thanks for the reply :),

here the html result of 1st page:

<div class="view">

<div id="gallery">

<a title="" href="/images/Battlefield 3.jpg">

<img width="120" height="100" src="/images/thumbs/COD3.jpg" alt="Battlefield 3" /></a>

</div>Battlefield 3<br /><a href="/index.php/site/contact">Call us</a><br />


when i click the 2nd page, there is no html result for the item in 2nd page, but it is same as the 1st page html result, i think, it is because of the pagination with ajax…right? i use CListView widget.

have anyone use it with CListView widget?