Found it in this comment of the controller section (action parameter binding) of the guide:
// $int is needed
// $cat is optional with default value
// $foo is optional with no default value
public function actionFoo ($int, $cat='default value if you need it', $foo=null)
{
...
}
We have one controller TrialController.php in controller folder.
Then we have two views one.php and two.php in views/trial folder.
TrialController.php
<?php
class TrialController extends Controller
{
// action one renders view one and displays the link.
public function actionOne()
{
$this->render("one");
}
public function actionTwo($id,$name)
{
//$id and $name are available inside the method.You can do whatever logic you can do with them
//Here we are just passing them to the view.
$this->render("two",array("id"=>$id,"name"=>$name));
}
}
views/trial/one.php
<?php
$id=1;
$name="someValue";
//You can also pass dynamic variable from form submission or database tables.
echo CHtml::link("click",array("trial/two","id"=>$id,"name"=>$name));
//Here CHtml::link calls CHtml::normalizeUrl and creates url from the second parameter.
?>
views/trial/two.php
<?php
echo "your id is :".$id;
echo "</br>";
echo "your name is :".$name;
?>
can you guys help me of how to set view to another view model? and configuring the controller? dunno how to set up things like that, newbie here, as in totally newbie thanks anyway