Home > centOS, Fedora 12, PHP, Unix/Linux, Zend > Zend view and layout

Zend view and layout

How to zend view/layout?

  1. Default
    $zf enable layout == application/layouts/scripts/layout.phtml
    default page == application/views/scripts/index/index.phtml
  2. Mannual* make directory under > application/views/scripts/folder/file.phtml
    * make controller under > application/controllers/FolderController.php
    FolderController.php > indexAction(){}
Practical: Steps: Results: (whats happening?)
#

# Edit: application/views/scripts/index/index.phtml

#

<p>
[[[ Hello world – i am from application/views/scripts/index/index.phtml ]]]

</p>

a. Default body content fix Nothing just prepared a default body.
#

# Edit: application/layouts/scripts/layout.phtml

#

— Header (application/layouts/scripts/layout.phtml)–

<?php echo $this->layout()->content; ?>

— Footer (application/layouts/scripts/layout.phtml)–

b. Default layout fix By Visiting: http://localhost/myzf/public/


a. layout.phtml loaded
b. controller action is triggerd
c. it took the page contents
d. it apply function rest actions

#

# Make & Edit:

# application/views/scripts/shamun/index.phtml

#

<p>

[[[ shamun mannual – i am from application/views/scripts/shamun/index.phtml ]]]

</p>

#

# Make & Edit:

# application/controllers/ShamunController.php

#

class ShamunController extends Zend_Controller_Action

{

public function init()

{

/* Initialize action controller here */

}

public function indexAction()

{

// action body

echo ‘<p style=”color:red;”>[[[shamun – i am from application/controllers/ShamunController.php]]]</p>’;

}

}

c. Make mannual views or pages or nice looking url! By visiting: http://localhost/myzf/public/shamun/


a. layout.phtml loaded

b. controller action is triggered

c. it look the page contents

d. it apply function rest actions

Advertisements
Categories: centOS, Fedora 12, PHP, Unix/Linux, Zend
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: