Php_template is a project mainly written in PHP and RUBY, it's free.
A staring template for new php projects.
It provides a very basic router which handles the routing of urls to layouts and pages in the views directory.
This project already includes some starter view files in the /views directory to help you get going as soon as possible. The organization of the views structure is the key:
views |-- about | |-- index.php | `-- me.php |-- default | |-- contact.php | `-- index.php `-- layouts |-- _footer.php |-- _header.php |-- about.php `-- default.php
The layouts/default.php is the default layout and will be used most of the time, especially for simple site layouts. A few examples will make urls to file mapping clear.
In your web browers, going to:
The routing logic starts to change if new layout files exists that matches the url, like in the case for the layouts/about.php layout.
What happens when the layouts don't exist? The layout falls back to the layouts/default.php. More examples:
The reasoning behind these conventions is so that the designer does not have to update a configuration when he or she needs to add a new layout. He can just add the layout and it will be picked up.
If you have git installed:
$ git clone http://github.com/tongueroo/php_template.git $ mv php_tempate your_project_name
If you do not have git installed:
Go to http://github.com/tongueroo/php_template and click on the "Download Source" link.
For programmers familiar with MVC: This is meant to be a very thin layer of routing to views; there is no support for database connections and the concept of controllers has not been introduced on purposes.
Running tests: The router specs are in the /test directory and can be ran with: $ phpunit test/router_test.php.