ViewsView part in the MVC structure is responsible to present data in front of users. They mainly contain the HTML content and presentational PHP code. Creating ViewsLook at the About page code of basic Yii page. And it's output is this: In the above script, PHP code is used to generate the dynamic content in title and inside the form tag. HTML tags displays the data in a presentation view. View Conventions
Following controller methods can be called to render views within controller:
Following controller methods can be called to render views within another view:
Following controller methods can be called to render views within widgets:
Example: Step 1 Inside views/site folder, we are creating a view file exm.php file. Step 2 Render exm.php view file in the about.php view file in the site folder. Step 3 Run it on the browser. Next TopicYII Controllers |