[Extension] jqPrettyPhoto

I believe the extension doesn’t “see” the images in your subsequent pages.

I haven’t used it with CListView, but I did use it with dynamically generated content. This post from sieppl helped me.

Thanks Bennouna, it is working now, i use the sieppl method. Have a nice weekend :)

First, I will say thank you for the extension! Saves a lot of time!

I had a problem with a few galleries in one page.

I added a galleries as follows:




<?php foreach ($model as $gallery) :?>

  	<div class="galleryPhotos-<?php echo $gallery->id; ?>">

            <?php

            $photos = $gallery->galleryBehavior->getGalleryPhotos();

                foreach ($photos as $item) echo CHtml::link (CHtml::image($item->getUrl('thumb'),'',array ('class'=> 'imgb_g','style'=>'margin:5px;')),$item->getUrl());

            jqPrettyPhoto::addPretty('.galleryPhotos-'.$gallery->id.' a',jqPrettyPhoto::PRETTY_GALLERY,jqPrettyPhoto::THEME_DEFAULT, $options);

            ?>

            

        </div>

</div>

<?php endforeach; ?>



But unfortunately only worked last gallery. :(

To ensure that all was well, I made the following changes to jqPrettyPhoto.php




	public static function addPretty($jsSelector=".gallery a", $gallery=self::PRETTY_GALLERY, $theme=self::THEME_DEFAULT, $opts=array()){

		

		self::registerScript();

		

		$opts['theme']=$theme;

		

		

		Yii::app()->clientScript->registerScript($jsSelector,'

			$("'.$jsSelector.'").attr("rel","prettyPhoto'.($gallery==self::PRETTY_GALLERY?'['.uniqid().']':'').'");

			$("a[rel^=\'prettyPhoto\']").prettyPhoto('.CJavaScript::encode($opts).');

		',CClientScript::POS_READY);

	}



Hope this will help someone!

(If I made a mistake somewhere - enter, I want to know)

Can I ask what the best method is to use to get an array of images to iterate with this extension?