Template Driven PHP Architecture
By Inforlinx2004-06-23
Introduction to using templates and PHP
PHP is an open source and license free language. PHP can be optimized to suit the requirements of different users. The optimization we speak of is possible by either including code snippets downloaded from online communities or by reusing the code once used before. This helps in promoting reusability. The benefits offered by this method include reduced development time and a decrease in testing time.
The above-mentioned benefits can be availed, using a TEMPLATE. A template is nothing but a HTML layout capable of including a PHP code, which is stored in a File.
Why do you need a template?
Classic programmer and the designer scenario:
Designers speak of languages as HTML and CSS, and programmers contemplate of PHP and SQL amongst others. Hence design and programming are two different aspects. Design focuses primarily on presentation, and programming focuses on business logic and logical implementation. Diversifying the concept of designing from programming leads to RAD (Rapid Application Development).
Often in a business scenario the need occurs to change the server side script. PHP makes things easy for a programmer to change the logic, without distorting the underlying design. Changes to presentation logic and design require designers to change to their necessary files, which, without a templating system, may also contain server-side code like PHP.
From the designers end, he makes changes to the website templates, using a simple templating language, to access data from the business logic layer. In short, a templating engine separates the business logic (programming) (PHP) from the design (HTML), allowing designers and programmers to interoperate more effectively.
Given the importance of website templating, there are many options from which to choose a template system implementation. Many individual members of the Open Source software development community have contributed simple and functional versions of PHP-based templating systems. Some are more suited for particular purposes than others. You may have a templating system in place, having an application programming interface (API), whether via function calls on included libraries or method invocation on various template-related objects.
Tutorial Pages:
» Introduction to using templates and PHP
» A case study
» The HTML file
» The PHP file
» The variable
» What happens when a PHP page is invoked
