News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

phpRiot.com:
Application logic versus template logic
May 02, 2006 @ 07:41:02

phpRiot.com has posted this new tutorial today that looks at a method to seperate out the application logic and the templates for your site. Their weapon of choice is the Smarty Template Engine.

What this is basically saying is that anything relating to the final output should be determined in the template, while any data handling or processing should be done in your PHP files and classes. There's a little more to it than though, which we'll soon see.

They introduce the reader to what the two sides are (application and template logic) and an example of the "bad way" to do things - application logic in your presentation layer. To counter this, they give examples of proper structure with examples like checking strings, alternating background colors, showing a counter, and the inclusion of another template.

A few other suggestions are made as to the good and the bad of templating your site, including two cases showing both sides.

0 comments voice your opinion now!
application template logic seperation smarty engine application template logic seperation smarty engine


blog comments powered by Disqus

Similar Posts

PHPBuilder.com: Creating Real Time Applications with PHP and WebSockets

Arnold Daniels' Blog: How I PHP: The Output Handler

Andre Liem's Blog: 5 tips and tools to optimize your php application - Part 1 simple

Chris Hartjes' Blog: "Refactoring Legacy Applications Using CakePHP" is now available!

IBM developerWorks: Understanding the Zend Framework, Part 1: The basics


Community Events

Don't see your event here?
Let us know!


api opinion laravel5 community framework introduction release development unittest series middleware wordpress podcast interview library extension language threedevsandamaybe laravel voicesoftheelephpant

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework