Zend Framework 1.12.3, part 3 – adding layout to project

In last post You build application with your controller animals and action
describe.
In this part we rebuild our application, add layout and style, image.
Let’s begin.
Right click on MyDog project and choose Zend->Run command.
In Run Zend Command window write enable layout in Filter field.
Click Run button.
In project structure You see new node: layout contained script folder with
layout.phtml file.
If You double click this file in tree structure, you see this content:

You change this content it, copy content from describe.phtml file:



My dog


My dog




but in body tags paste:

and delete line:

My dog


Line:

My dog


You paste into describe.phtml file.
And then we may add same things to our website. You have title “My dog“.
Lets add its photo.
So insert img tag:

and save this file.
In public node create images folder, right click on public folder and
choose New->Folder.
In Folder Name field write images and click on Finish button.
In tree project You see new folder.
And now You drag and drop with mouse photo into images folder in Netbeans
IDE.
You see file dog.jpg into images folder.
In Zend You may use baseUrl function. In this way transfer application to
another folder it will be running true. So we must modify our img tag.

Run applicaton.
In the same way You may set css style.
Create css folder in public node and in it mycss.css file.
This file create right clicking on public/css node and choosing New-
>Cascading Style Sheet.
In New CSS window You write mycss in File Name field and click Finish
button.
You see empty css file.
Write this line into it:
body
      {
         background-color:#e5f6cd;
         color:#3d4d25;
         text-align:center;
     }
img
       {
        align:center;
       }

And this new structure of application:
In layout.phtml add new line after meta tag:

Lets see result running application.