Ok.Today my aim is to devolope an enhanced MVC example....
In Yii we can pass the data to view from controller as ARRAY of data..
Let us go on....
First I will create my controller.Below is my controller.
Save it in C:\wamp\www\yii\myyii\protected\controllers or in your controller directory.
Read the commented lines carefully....
<?php
class PaymentController extends Controller{
function actionDetail(){
$content['all']=date('d/m/y');//Here I assingn the date velue, returning from date function to a array .
$this->render('Detail',array('content'=>$content));//Then I pass that array values to the view.
}
}
?>
Now I need a view to show all the data recived from controller.
Below is my view and save it in C:\wamp\www\yii\myyii\protected\views\Payment directory.
N.B-->here you have to create a folder called Payment inside the views and payment is the name of the controller.
<?php
foreach ($content as $data){ //here I unzip the data,retrived from contrller.
echo($data);
}
?>
That is all and visit the below link by typing in address bar.
And you will see the date as the output.
In Yii we can pass the data to view from controller as ARRAY of data..
Let us go on....
First I will create my controller.Below is my controller.
Save it in C:\wamp\www\yii\myyii\protected\controllers or in your controller directory.
Read the commented lines carefully....
<?php
class PaymentController extends Controller{
function actionDetail(){
$content['all']=date('d/m/y');//Here I assingn the date velue, returning from date function to a array .
$this->render('Detail',array('content'=>$content));//Then I pass that array values to the view.
}
}
?>
Now I need a view to show all the data recived from controller.
Below is my view and save it in C:\wamp\www\yii\myyii\protected\views\Payment directory.
N.B-->here you have to create a folder called Payment inside the views and payment is the name of the controller.
<?php
foreach ($content as $data){ //here I unzip the data,retrived from contrller.
echo($data);
}
?>
That is all and visit the below link by typing in address bar.
And you will see the date as the output.