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 Zend framework


Having created the controller and the model, you can proceed to create a view and give your application a face.

How to do it...

  1. Go to the <project-root>/module/Application/view/application/cooking directory, create a new PHP file, and name it index.phtml.

    Phtml is a special extension used in the Zend framework that tells the web server that the expected content in the file will be more HTML and less PHP.

    In other words, it is a way to tell the server that the file is a view component. Just as you have been doing all this while to create a view, you will take similar actions this time as well. After all, a view is a view.

  2. You will create something like the following code:

    <?php echo $this->doctype(); ?>
    <html lang="en">
    <head>
    <?php echo $this->headTitle('Let us cook '.$dishname)->setSeparator(' - ')->setAutoEscape(false) ?>
    </head>

    Now we've defined the title. Let's move to other parts of the code, which are...