/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Lightbox the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Lightbox::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<section> <div> <?php $lightbox = Lightbox::model()->findAllByAttributes(array('activo' => 1)); if (count($lightbox) > 0) { foreach ($lightbox as $light) { ?> <a style="display: none" id="link" href="<?php echo Yii::app()->request->baseUrl; ?> /images/lightbox/<?php echo $light->imagen; ?> " data-lightbox="<?php echo $light->imagen; ?> ">Image #1</a> <!-- <a class="example-image-link" href="<?php echo Yii::app()->request->baseUrl; ?> /images/lightbox/<?php echo $light->imagen; ?> " data-lightbox="example-1"><img class="example-image" src="<?php echo Yii::app()->request->baseUrl; ?> /images/lightbox/<?php echo $light->imagen; ?> " alt="image-1" /></a>--> <script>