1

モデル -

enter code here
 public function searchShop()
{
        $criteria = new CDbCriteria();
            $criteria->compare("name", $this->category, TRUE, "OR");
                $criteria->compare("shopname", $this->category, TRUE, "OR");
                    $criteria->compare("category", $this->category, TRUE, "OR");

            return Shops::model()->findAll($criteria);  
}

コード - -

enter code here
<?php 
foreach($models as $model):
    $this->widget(
'bootstrap.widgets.TbDetailView',
array(
'type'=>'bordered condensed',
'data' => array(
'id' =>array('view', 'id'=>$model->ID),
'Shop Name' => $model->shopname,
'Category' => $model->category,
'ID' => CHtml::link(CHtml::encode($model->ID), array('view', 'id'=>$model->ID))
),
'attributes' => array(
array('name' => 'Shop Name', 'label' => 'Shop name'),
array('name' => 'Category', 'label' => 'Category'),
array('name' => 'ID', 'label' => 'ID'),
),
)
);

echo "<br><hr><br>";
 endforeach;
 ?>

ID をクリックしてリンクが必要です。ビュー ファイル、つまりショップ モデルの view.php がレンダリングされます。

CHtml::link(CHtml::encode($model->ID), array('view', 'id'=>$model->ID)) を使用しましたが、そのビューのパスを1として表示しています

助けて...よろしくお願いします

4

1 に答える 1