Book Image

PhpStorm Cookbook

By : Mukund Chaudhary
Book Image

PhpStorm Cookbook

By: Mukund Chaudhary

Overview of this book

Table of Contents (16 chapters)
PhpStorm Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a view with the Yii framework


Now, create a view to make your application complete. In creating a new view, you need to be careful.

How to do it...

The proper location of a view in a project is the <project-root>/views/<first-name-of-the-controller> directory. Thus, you will require a new directory under the views. Create a new directory with the name cooking. Inside this directory, create a new PHP file with the name index.php. Having done that, you need to write some basic HTML code to make a view. You might write something like the following code:

<?php
use yii\helpers\Html;
$this->title = 'Let us cook ';
?>
<!DOCTYPE html>
<html >
<head>
<head>
<meta charset="<?= Yii::$app->charset ?>"/>
<title><?= Html::encode($this->title).$dishname ?></title>
<style type="text/css">
.align-center{text-align: center;}
.heading {font-weight: bold;font-size: 40px;}
.normal-text {font-size: 16px;}
</style&gt...