ThickBox Implementation

How to implement the ThickBox(http://jquery.com/demo/thickbox/) within a project that powered by Yii?

Quote

How to implement the ThickBox(http://jquery.com/demo/thickbox/) within a project that powered by Yii?

Hello Ramin,

I think the smartest way, would be to build an extension, which wrap the functionallity of the thickbox script.

In this case, the required Steps are:

  1. publish and register the clientside files like .css and .js

  2. build and output the required markup (html)

I attached an unfinished version, how this could look like.

At the moment it features the "single image" and "image gallery" mode.

I leave it to you to implement the 3 remaining modes ('inline', 'iframed' and 'ajax').

Download it here.

Unpack it to the "protected/extensions" folder of your yii project.

For a single image use:



<?php 


$this->widget('application.extensions.thickbox.EThickbox',


	array(


		'mode'=>'image',


		'data'=>array('images/yii-powered.png', 'images/logo.gif', 'Yii rocks...')


	)


);


?>

or for a gallery:



<?php 


$this->widget('application.extensions.thickbox.EThickbox',


	array(


		'mode'=>'gallery',


		'data'=>array(


			array('images/plant1_t.jpg', 'images/plant1.jpg', 'description text...'),


			array('images/plant2_t.jpg', 'images/plant2.jpg', 'another description text...')


		)


	)


);


?>

And remeber, this should just be an example for you, how to build an extension and not a complete wrap up for the thickbox script.

Ahh and it seems that thickbox has some troubles with jquery 1.3.0 which comes with yii 1.0.2.

greets ironic

Excellent! Thank you for the clear answer.

Regards,

Ramin

Thanks, it worked for me .

The issue with jQuery 1.3.0 is that the gallery mode won't work.

It's fixed by changing thickbox.js line 79 from

to

i can’t download for “thickbox.zip (21.92K)”

error: [#10173] We could not find the attachment you were attempting to view.

Note that thickbox has not been maintained since 2009