eotz
(Syamsuri Core)
1
i have page gallery image
in contoller/gallery
public function actionGallery($id)
{
$dataProvider=new CActiveDataProvider('image',array(
'criteria' => array(
'condition' => 'user_id = '.$id.'',
'order' => 'id DESC',
),
));
$this->render('gallery', array(
'dataProvider'=>$dataProvider,
));
}
in view/gallery
<?php
$this->widget('bootstrap.widgets.TbListView',array(
'dataProvider'=>$dataProvider,
'template'=>'{items} {pager}',
'itemView'=>'_gallery',
));
?>
in _gallery
<div id ="gallery">
<a href="#popup-modal" onclick='$("#popup-modal").data("id",$("#id").val());' data-toggle="modal" >
<?php echo TbHtml::image(Yii::app()->baseUrl.'/images/user/'.$data->docpath,'',array(
'class'=>'imggallery',
));?>
</a>
</div>
<?php $this->beginWidget('bootstrap.widgets.TbModal', array('id' => 'popup-modal'));?>
<div class="modal-header"> <a class="close" data-dismiss="modal">×</a> <h3>login</h3> </div>
<div class="modal-body">
<?php echo TbHtml::image(Yii::app()->baseUrl.'/images/user/'.$data->docpath,'',array(
'class'=>'imggallery',
));
echo $data->docpath;?>
</div>
<?php $this->endWidget(); ?>
the problem is how to passing id of image.
If its rendered into a dialog then you should use renderPartial(). You can pass the $id in the paramters:
$this->renderPartial('gallery', array(
'dataProvider'=>$dataProvider,
'id' => $id,
));
eotz
(Syamsuri Core)
3
nothing change
.what should i do
i click image or image 2
6750
1.JPG
always show the same image
6751
2.JPG
softark
(Softark)
4
[color="#006400"]/* topics merged and moved to proper section */[/color]
eotz
(Syamsuri Core)
5
view/image/gallery
<?
$this->widget('bootstrap.widgets.TbListView',array(
'dataProvider'=>$dataProvider,
'template'=>'{items} {pager}',
'itemView'=>'_gallery',
));
$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
'id'=>'cru-dialog',
'options'=>array(
'title'=>'Photo',
'autoOpen'=>false,
'modal'=>true,
'width'=>430,
'height'=>400,
'closeOnEscape' => true,
),
));
?>
<iframe id="cru-frame" width="100%" height="100%" scrolling="yes" frameborder="1"></iframe>
in view/images/_gallery
<?php
$user_id=Yii::app()->user->id;
$createUrl = $this->createUrl('gallerydtl',array('id'=>$data->id));
$show_images = TbHtml::image(Yii::app()->baseUrl.'/images/user/'.$data->docpath,'',array('class'=>'imggallery'));
?>
<!--# for display horizontal-->
<?php $pageSize = $widget->dataProvider->getPagination()->pageSize;?><!--1.1-->
<?php if($index == 0) echo '<div class="row">'; ?><!--1.2-->
<div class="span"><!--1.3-->
<div id ="gallery">
<?php
echo CHtml::link($show_images,'', array(
'class' => '',
'onclick'=>"$('#cru-frame').attr('src','$createUrl '); $('#cru-dialog').dialog('open');return false;",
'data-toggle'=>'modal'
));
?>
<div id="fade" class="black_overlay"></div>
</div>
</div><!--1.4 span-->
<?php if($index != 0 && $index != $pageSize && ($index + 1) % 4 == 0)
echo '</div><p></br><div class="row">'; ?><!--1.5-->
<?php if(($index + 1) == $pageSize ) echo '</div>'; ?><!--1.6-->