Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > by-pkgid > 8377d4bb25a3992aad680df2952f4b71 > files > 133

php-smarty-doc-2.6.26-1mdv2010.0.noarch.rpm

<HTML
><HEAD
><TITLE
>Preface</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Smarty Manual"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Smarty Manual"
HREF="index.html"><LINK
REL="NEXT"
TITLE="Getting Started"
HREF="getting.started.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="preface"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Smarty Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="index.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="getting.started.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="preface"
><H1
><A
NAME="preface"
></A
>Preface</H1
><P
>&#13;   It is undoubtedly one of the most asked questions on the PHP mailing
   lists: how do I make my PHP scripts independent of the layout? While
   PHP is billed as "HTML embedded scripting language", after writing a
   couple of projects that mixed PHP and HTML freely one comes up with the
   idea that separation of form and content is a Good Thing [TM]. In
   addition, in many companies the roles of layout designer and programmer
   are separate. Consequently, the search for a templating solution
   ensues.
  </P
><P
>&#13;   In our company for example, the development of an application goes on
   as follows: After the requirements docs are done, the interface
   designer makes mockups of the interface and gives them to the
   programmer. The programmer implements business logic in PHP and uses
   interface mockups to create skeleton templates. The project is then
   handed off to the HTML designer/web page layout person who brings the
   templates up to their full glory. The project may go back and forth
   between programming/HTML a couple of times. Thus, it's important to
   have good template support because programmers don't want anything to
   do with HTML and don't want HTML designers mucking around with PHP
   code. Designers need support for config files, dynamic blocks and
   other interface issues, but they don't want to have to deal with
   intricacies of the PHP programming language.
  </P
><P
>&#13;   Looking at many templating solutions available for PHP today, most of
   them provide a rudimentary way of substituting variables into templates
   and do a limited form of dynamic block functionality. But our needs
   required a bit more than that. We didn't want programmers to be dealing
   with HTML layout at ALL, but this was almost inevitable. For instance,
   if a designer wanted background colors to alternate on dynamic blocks,
   this had to be worked out with the programmer in advance. We also
   needed designers to be able to use their own configuration files, and
   pull variables from them into the templates. The list goes on.
  </P
><P
>&#13;   We started out writing out a spec for a template engine back in late
   1999.  After finishing the spec, we began to work on a template engine
   written in C that would hopefully be accepted for inclusion with PHP.
   Not only did we run into many complicated technical barriers, but there
   was also much heated debate about exactly what a template engine should
   and should not do. From this experience, we decided that the template
   engine should be written in PHP as a class, for anyone to use as they
   see fit. So we wrote an engine that did just that and
   <SPAN
CLASS="productname"
>SmartTemplate</SPAN
> came into existence (note: this
   class was never submitted to the public). It was a class that did
   almost everything we wanted: regular variable substitution, supported
   including other templates, integration with config files, embedding PHP
   code, limited 'if' statement functionality and much more robust dynamic
   blocks which could be multiply nested. It did all this with regular
   expressions and the code turned out to be rather, shall we say,
   impenetrable. It was also noticably slow in large applications from all
   the parsing and regular expression work it had to do on each
   invocation. The biggest problem from a programmer's point of view was
   all the necessary work in the PHP script to setup and process templates
   and dynamic blocks. How do we make this easier?
  </P
><P
>&#13;   Then came the vision of what ultimately became Smarty. We know how fast
   PHP code is without the overhead of template parsing. We also know how
   meticulous and overbearing the PHP language may look to the average
   designer, and this could be masked with a much simpler templating
   syntax. So what if we combined the two strengths? Thus, Smarty was
   born... :-)
  </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="getting.started.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Smarty Manual</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Getting Started</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>