转载自:http://www.yiichina.org/forum/thread-218-1-1.html
//这样写就可以传送参数用get方法接收
$this->redirect(array('category/show',array('id'=>1,'rule_id'=>'1'))); 2. 原始代码
<?php echo CHtml::linkButton('Logout',array(
'submit'=>'',
'params'=>array('command'=>'logout'),
));
?><?php echo CHtml::Button('Delete', array (
'submit' => $this->createUrl('post/delete',$this->getReturnParams()),
'params' => array('id'=>123),
'confirm'=>'Are you sure?'
))
?>
------------------------------------------------------------------------------------------------------------------------------------------------
代码可以先取出用户已经选的选项,再赋值到前台页面中
------------------------------------------------------------------------------------------------------------------------------------------------
<?php foreach($options = $tempradio as $key => $value): ?>
<?php
if ($field->value == $key)
echo "<span class='radio'>",CHtml::radioButton($field->id, true, array("class" => "noborder", "value" => $key)),$value,"</span>";
else
echo "<span class='radio'>",CHtml::radioButton($field->id, false, array("class" => "noborder", "value" => $key)),$value,"</span>";
?>
<?php endforeach; ?>
--------------------------------------------------------------------------------------------------------------------------------
tpl调用jquery的AJAX
--------------------------------------------------------------------------------------------------------------------------------
1.tpl中 调用js中的函数startAlert()
<?php echo CHtml::Button('Flag', array("id" => "cb_btn_$field->id", "name" => "cb_btn_$field->id", "onclick" => "startAlert('$field->id')"));?>
2.js中
function startAlert(id){
$.ajax({
type: "POST",
url: "http://www.cnblogs.com/Change",
data: "> 这样就可以取值Jsonstr['fieldid']