phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


Zend Framework Action: Including Header and Footer

Tag: framework, zend, zend framework, view, MVC, action, header, footer   Category: PHP Framework
post: 11 Apr 2008 read: 1,966


Zend Framework Action Step By Step Tutorial - Part 5: Last posting from this series, we talk about how to include header and footer for template. I know, may be this is not any relation with Zend Framework Action, but, may be this knowledge become useful for you to build web site now.

Create a file named "header.phtml" within views/scripts/user. Enter following code:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><? echo $this->escape($this->title); ?></title>
</head>
<body>
<div id="header">
My Zend Framework
</div>

Now, create a file named "footer.phtml" within views/scripts/user. Enter following code:


<div id="footer">
By PHPEveryday.com
</div>
</body>
</html>

Last, update "name.phtml" within views/scripts/user with this:


<? include "header.phtml"; ?>
  <h1><?=$this->escape($this->title);?>, <?=$this->escape($this->name);?></h1>
  <h2>Gender: <?=$this->escape($this->gender);?></h2>
<? include "footer.phtml"; ?>

Now, try to point your browser to http://localhost/test/zend/helloworld/web_root/user/ name/username/wiwit/gender/man



Series this article:
Zend Framework Action: Dynamic Content
Zend Framework Action: URL Structure and Controller
Zend Framework Action: URL Structure and Action
Zend Framework Action: GET Parameters
Zend Framework Action: Including Header and Footer

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Joomla: Fast Road to Understand Component Programming
Chart: How to Build Cool Animation Real Time Chart
Email: Send Attachement Mail
SMS : Sending SMS with PHP and ActiveXperts (Part 1)

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


624
posting