/**
  * 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 TbaParam the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = TbaParam::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Beispiel #2
0
<?php

$marquee = TbaParam::model()->findByAttributes(array('param' => 'marquee_size'));
$size = $marquee->pvalue;
//取的變數內容;
echo "<span style=font-size:" . $size . "px>";
echo CHtml::link($quote->title, array('tbaBoard/empread?id=' . $quote->id), array('target' => '_self'));
echo "</span>";
Beispiel #3
0
?>
/css/example.css" />

<div class="announe">          <!--tableBlue -->
     
<?php 
echo CHtml::beginForm();
?>

       <table >
           <tr>
               <td>  
                   <table >
                     
                       <?php 
$row_num = TbaParam::model()->findByAttributes(array('param' => 'board_num'));
//取sql值時,先取得變數代碼等於 'select * from tba_param where param = board_num'
$row = $row_num->pvalue;
//取的變數內容;
//直接從Contraller的actionAnnounce移過來
$today = date('Y-m-d');
//今天日期
//使用sql寫法
$sql = "SELECT a.id, a.title, a.content, a.dates, b.read FROM\n                               (SELECT * FROM `tba_board` WHERE datee >='{$today}' ) a LEFT JOIN `tba_board_emp_log` b\n                               ON a.id = b.board_id order by datee desc limit {$row}";
$result = Yii::app()->db->createCommand($sql)->queryAll();
for ($i = 0; $i < count($result); $i++) {
    echo "<tr>";
    echo "<td>";
    echo "<b>#-</b> " . CHtml::link($result[$i]['read'] ? $result[$i]['title'] : "<b>" . $result[$i]['title'] . "</b>", array('tbaBoard/empread?id=' . $result[$i]['id']), array('target' => '_self'));
    echo "</td>";
    echo "</tr>";