Tag: tutorial

Zend Framework 1 tutorial Part 6: The application bootstrap.php file

Zend Framework 1 Logo

It's time to create a bootstrap file, in the bootstrap we will initialize the application. Open the myapp/application directory and create and empty bootstrap.php file.

For a basic bootstrap I have added a lot of code, that I will explain in the few chapters of this article, but there are several things a haven't added just yet. For example, one thing I haven't included yet is the database initialization as well as the database profiler initialization, I will add that part as soon as we need it.

Zend Framework 1 tutorial Part 5: The index.php file

Zend Framework 1 Logo

Go into the public folder and create a new file called index.php. As I already mentioned in the htaccess chapter, this file receives all the requests and passes them to the Zend Framework which will dispatch them.

Zend Framework's controller uses the frontcontroller design pattern. All requests to the frontcontroller will get rooted through a single entry point, the index.php file.

Zend Framework 1 tutorial Part 4: The application configuration file

Zend Framework 1 Logo

Go into the "application/configs" folder and create a new file called application.ini. We will need this configuration file to setup some default values for our application. We will see in the next tutorial how the index.php loads this file and passes its values to the application class to create an instance.

As you can see below we have three parts in our configuration file, a config setp for the production environment. Another for the testing environment which inherits the values set for the production mode but changes some values. Finally a setup for the development environment which inherits the values from testing mode (and therefore also from production mode) but also changes some values.

Zend Framework 1 tutorial Part 3: The ZF project htaccess file

If you have read the you should have created a public directory and if you installed XAMPP by using the following XAMPP tutorial, this directory will probably be in "C:\xampp\htdocs\myapp\public". Open the "public" folder of your app and create a new file called ".htacess" using your text editor or your IDE. If you can't see the htaccess file in the public folder after creating it, open the view "tab" in the Windows Explorer and enable "File name extensions and Hidden items" by clicking the checkbox next to it.

Adding an environment variable to our htaccess

The first thing we will add to our htaccess file is the environment variable. Our app will have an environment variable which will have three possible values, the first one is "development", the second one is "testing" and the third one is "production". "development" will be the environment type we will use while developing our application. "testing" is the environment variable value we will use while testing of our application and finally "production" is application environment we will use after we have deployed our application on the production server(s).

Zend Framework 1 tutorial Part 2: The directories structure

Zend Framework 1 Logo

My goal was to create a structure that is very easy to understand, flexible enough for big or small websites and not totally different from what books or other guides recommend as a "files and folders structure for a Zend Framework project" best practice.

Another goal was to create a CMS core, which has lots of modules that can be (re)-used on (multiple) other websites. Every module is designed so that it can be copied and put in another project without having to modify any file of that project. The main directory of each module contains all the files it needs to work, I has its own bootstrap, its own configuration files, its views and of course its own models.

Zend Framework 1 tutorial Part 1: Installing and configuring Apache, PHP, MySQL and an IDE

XAMPP: Apache, PHP, MySQL, PHPMyAdmin

This Zend Framework 1 application will be explain how to build a news portal or blogging website using the Zend Framework. But first let's install a development platform and an IDE. If you have already the tools needed you can jump to the next step.

If you prefer to install your development platform on a Mac, I recommend using Mamp (Mac, Apache, MySQL, PHP) or Homebrew (A package manager for OS X that can be used to quickly install MySQL, PHP and Apache).

If you want to install a development platform on Linux, for example on Cent OS 6 you might want to check out my Cent OS 6 Server Setup tutorial.

  • First
  • Previous
  • 1
  • Next
  • Last