Jara Base – a base Zend Framework app

I recently had to set up a Zend Framework project at a friend’s house and realized how reliant I am on Zend Studio to set up a fresh project. Meet Jara Base – the ZF starter app and my solution to this minor issue. It’s essentially a slightly modified version of the Zend Studio project structure with the following variations/additions:

  • Added a test helper to the tests folder.
  • Added a static route plugin for handling static site pages.

Usage

Adding static pages

Most applications have pages for static content e.g. an about page, a contact page, etc. I prefer my static pages without the controller name and the ‘page’ route removes the need to add the controller name to the url. Jara Base already includes an about page with a corresponding view and this page is accessed with ‘http://www.example.com/about’ rather than ‘http://www.example.com/index/about’.

To add a static page, add an action to the ‘Index’ controller of the ‘Default’ module. Add a corresponding view and the page will be available at ‘http://www.example.com/:action’.
Static routes with the same name as your controller actions are created by default.
To disable static routes, comment out (or delete) the static routes line in the plugins section of the application config file (application.ini).

No related posts.

This entry was posted in Zend Framework. Bookmark the permalink.

3 Responses to Jara Base – a base Zend Framework app

  1. Wil Sinclair says:

    We hope to really nail this issue with 1.8. Our RAD tools like Zend_Tool will generate a default project structure that is recommended by the ZF team. Of course, it will also work with a custom project structure. :)

    ,Wil

  2. Eric Marden says:

    I had to add this to Initializer.php on lines 15 – 18 to get jara base app to work out of the box:


    ini_set('include_path',
    ini_get('include_path') .
    PATH_SEPARATOR . APP_ROOT . '/library'
    );

    This assumes you added the framework to /library/Zend

  3. Ekerete says:

    @Eric, My bad. Thanks for the heads-up.

    I have the Zend Framework files in my include path and the Initializer class assumed the files would always be available.

    It’s fixed now! I have added the Zend Framework files (version 1.7.6) to the library folder and reworked the bootstrap process to set up the include paths before loading the Initializer class.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>