Skip to content

Instantly share code, notes, and snippets.

@taleeb35
Last active August 29, 2015 14:26
Show Gist options
  • Save taleeb35/8da8a62141ef50cba794 to your computer and use it in GitHub Desktop.
Save taleeb35/8da8a62141ef50cba794 to your computer and use it in GitHub Desktop.
<!-- View File -->
<div id="data">
<div class="container-fluid max-width">
<div class="row">
<div class="project-detail clearfix">
<div class="col-md-4 portfolio_view">
<h2><?php echo CHtml::encode( $model->address ); ?>
<?php if ( $model->city ): ?>
, <?php echo CHtml::encode( $model->city->name ); ?>
<?php endif; ?>
</h2>
<p><?php echo nl2br( CHtml::encode( $model->content )); ?></p>
<hr/>
</div>
<?php if ( $model->images && count( $model->images )): ?>
<div class="col-md-8">
<div id="slider" class="owl-carousel owl-theme project">
<?php foreach( $model->images as $image ): ?>
<div class="item"> <img src="<?php URL_SITE ?> /project_images/<?php echo $image->filename; ?>"
alt="<?php echo $image->caption; ?>">
</div>
<?php endforeach; ?>
</div>
<?php if ( $previousId = $model->getPreviousId() ): ?>
<a href="<?php echo $this->createUrl( "/portfolio/item/id/{$previousId}" ); ?>"
class="button align-left">&#8672; Previous Project</a>
<?php endif; ?>
<?php if ( $nextId = $model->getNextId() ): ?>
<a href="<?php echo $this->createUrl( "/portfolio/item/id/{$nextId}" ); ?>"
class="button align-right">Next Project &#8674;</a>
<?php elseif ( $nextId = $model->getFirstId() ): ?>
<a href="<?php echo $this->createUrl( "/portfolio/item/id/{$nextId}" ); ?>"
class="button align-right">First Project &#8673;</a>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>
<?php echo CHtml::ajaxButton ("Update data",
CController::createUrl('portfolio/UpdateAjax/88'),
array('update' => '#data'));
?>
<!-- Controller -->
public function actionUpdateAjax($id)
{
//if (Yii::app()->request->isAjaxRequest) {
$model = $this->loadModel( $id, 'Project' );
$this->title = $model->address;
$this->subtitle = $model->address;
$this->description = $model->content;
if ( isset( $model->city ))
{
$this->title .= ' ' . $model->city->name;
}
if ( isset( $model->service ) && $model->service->id !== '0' )
{
$this->title = $model->service->title . ' at ' . $this->title;
$this->keywords = $model->service->keywords;
}
$this->renderPartial('_ajaxContent', array( 'model'=>$model ));
//}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment