Home arrow PHP arrow Build a Website with the Zend Framework

Build a Website with the Zend Framework

In this third part of a four-part series on MVC and the Zend framework, you'll start building your first website based on the Zend framework and the model-view-controller pattern. This article is excerpted from chapter 25 of the book Beginning PHP and Oracle: From Novice to Professional, written by W. Jason Gilmore and Bob Bryla (Apress; ISBN: 1590597702).

TABLE OF CONTENTS:
  1. Build a Website with the Zend Framework
  2. Create the Front-End Controller
By: Apress Publishing
Rating: starstarstarstarstar / 2
September 16, 2010

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Creating Your First Zend Framework-Driven Web Site

Its a fair bet that even a very simple example will leave you utterly convinced that frameworks are a development tool you won't be able to live without.

Create the Directory Structure

By default, the Zend Framework relies upon a highly organized application directory structure known as the conventional modular directory structure. In its most basic form, this structure looks like this:

Web server document root/
    index.php
    application/
        modules/
           
default/
                controllers/
                views/
                    scripts/

This structure opens up the possibility to manage multiple hosted MVC applications within the same location. In a situation where multiple MVC applications exist, you would add additional module directories under the modules directory. However, for the purposes of the examples in this chapter, we'll just stick with a single (default) application.

Therefore, a simple Web application might be structured as follows. Note how there are three controllers and each of those controllers matches up to a corresponding view directory:

Web server document root/
    index.php
    application/
       
modules/
            default/
               
controllers/
                    IndexController.php
                    BookController.php
                    AboutController.php
                views/
                    footer.phtml
                    header.phtml
                    scripts/
                        about/
                            contact.phtml
                            index.phtml
                        book/
                            index.phtml
                            toc.phtml
                        index/
                            index.phtml

Don't worry about the oddly named files and structure too much at this point. Just understand that based on the provided controllers and views and a typical configuration, the following URLs would work:

http://www.example.com/ http://www.example.com/about/ http://www.example.com/about/contact/ http://www.example.com/book/ http://www.example.com/book/toc/

Because this directory structure won't suit every developer, it's possible to change the default settings; however, coverage of this feature is out of the scope of this chapter.



 
 
>>> More PHP Articles          >>> More By Apress Publishing
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: