Hello all
I was in need of a “popup” gallery function for yii, and quickly found the fancyBox extension - though it turned out that i actually couldn’t get this to work as i wanted to.
So i decided to download the new fancyBox2, and create myself an extension (with the fancybox extension as template) that easily can output a gallery in fancybox…
No more talk.
Download the rar file from: http://www.2shared.com/file/wn3QsSje/fancybox2.html
Unzip to your extension folder.
In your view file:
<a class="open_fancybox"><div class="fancybox-button"></div></a>
<?php $this->widget('application.extensions.fancybox2.EFancyBox2',
array(
'class'=>'open_fancybox', // The class where the fancybox will open from
'url'=>Yii::app()->request->baseUrl.'/files/'.$galleryFolder->id.'/', // Url to the gallery where all the images are in
'images'=>$galleryImages, // From the controller, found with "findAll" function.
'emptyText'=>'bla bla bla', // **Optional
'config'=>array( // **Optional - look the fancybox2 documentation for more information. http://fancyapps.com/fancybox/#docs
'helpers'=>array(
'title'=>array('type'=>'over'),
'thumbs'=>array(
'width'=>100,
'height'=>100,
'position'=>'bottom',
),
),
'mouseWheel'=>true,
'arrows'=>true,
'nextClick'=>true,
'loop'=>true,
'openEffect'=>'none',
'closeEffect'=>'none',
'prevEffect'=>'fade',
'nextEffect'=>'fade',
'padding'=>0,
),
)
); ?>
And in controller i personally use following:
$galleryFolder=Gallery::model()->findByAttributes(array('merchantId'=>$id));
$galleryImages=Galleryimages::model()->findAllByAttributes(array('galleryId'=>$galleryFolder->id));
Gladly write if you got any comments, or something you think should be changed.
But dont flame if you dont like it - just dont use it?
// Casper