Prev | Current Page 70 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

), which explains how to build e-commerce web sites with ASP.NET 2.0, C#, and
SQL Server 2005.
Using Smarty to Separate Layout from Code
Because PHP is simple and easy to start with, it has always been tempting to start coding without
properly designing an architecture and framework that would be beneficial in the long run.
What makes things even worse is that the straightforward method of building PHP pages
is to mix PHP instructions with HTML because PHP doesn??™t have, by default, an obvious technique
of separating the PHP code from the HTML layout information.
Mixing the PHP logic with HTML has two important disadvantages:
??? This technique often leads to long, complicated, and hard-to-manage code. Maybe you
have seen those kilometric source files with an unpleasant mixture of PHP and HTML,
which are hard to read and impossible to understand after a week.
??? These mixed files are the subject of both designers??™ and programmers??™ work, which
complicates the collaboration more than necessary. This also increases the chances of
the designer creating bugs in the code logic while working on cosmetic changes.
These kinds of problems led to the development of template engines, which offer frameworks
separating the presentation logic from the static HTML layout. Smarty (http://smarty.php.net) is
the most popular and powerful template engine for PHP.


Pages:
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
tanie rozmowy poker online przeprowadzki katowice spa nad morzem poker online