removing uneeded files

This commit is contained in:
nlopess
2004-03-23 18:25:17 +00:00
parent 56797a5940
commit fcf75d9e42
8 changed files with 0 additions and 10360 deletions

View File

@@ -1,419 +0,0 @@
<part id="appendixes">
<title>Appendixes</title>
<chapter id="troubleshooting">
<title>Troubleshooting</title>
<para></para>
<sect1 id="smarty.php.errors">
<title>Smarty/PHP errors</title>
<para>
Smarty can catch many errors such as missing tag attributes
or malformed variable names. If this happens, you will see an error
similar to the following:
</para>
<example>
<title>Smarty errors</title>
<screen>
<![CDATA[
Warning: Smarty: [in index.tpl line 4]: syntax error: unknown tag - '%blah'
in /path/to/smarty/Smarty.class.php on line 1041
Fatal error: Smarty: [in index.tpl line 28]: syntax error: missing section name
in /path/to/smarty/Smarty.class.php on line 1041
]]>
</screen>
</example>
<para>
Smarty shows you the template name, the line number and the error.
After that, the error consists of the actual line number in the Smarty
class that the error occured.
</para>
<para>
There are certain errors that Smarty cannot catch, such as missing
close tags. These types of errors usually end up in PHP compile-time
parsing errors.
</para>
<example>
<title>PHP parsing errors</title>
<screen>
<![CDATA[
Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75
]]>
</screen>
</example>
<para>
When you encounter a PHP parsing error, the error line number will
correspond to the compiled PHP script, not the template itself. Usually
you can look at the template and spot the syntax error. Here are some
common things to look for: missing close tags for {if}{/if} or
{section}{/section}, or syntax of logic within an {if} tag. If you
can't find the error, you might have to open the compiled PHP file and
go to the line number to figure out where the corresponding error is in
the template.
</para>
</sect1>
</chapter>
<chapter id="tips">
<title>Tips &amp; Tricks</title>
<para>
</para>
<sect1 id="tips.blank.var.handling">
<title>Blank Variable Handling</title>
<para>
There may be times when you want to print a default value for an empty
variable instead of printing nothing, such as printing "&amp;nbsp;" so that
table backgrounds work properly. Many would use an {if} statement to
handle this, but there is a shorthand way with Smarty, using the
<emphasis>default</emphasis> variable modifier.
</para>
<example>
<title>Printing &amp;nbsp; when a variable is empty</title>
<programlisting>
<![CDATA[
{* the long way *}
{if $title eq ""}
&amp;nbsp;
{else}
{$title}
{/if}
{* the short way *}
{$title|default:"&amp;nbsp;"}
]]>
</programlisting>
</example>
</sect1>
<sect1 id="tips.default.var.handling">
<title>Default Variable Handling</title>
<para>
If a variable is used frequently throughout your templates, applying
the default modifier every time it is mentioned can get a bit ugly. You
can remedy this by assigning the variable its default value with the
<link linkend="language.function.assign">assign</link> function.
</para>
<example>
<title>Assigning a template variable its default value</title>
<programlisting>
<![CDATA[
{* do this somewhere at the top of your template *}
{assign var="title" value=$title|default:"no title"}
{* if $title was empty, it now contains the value "no title" when you print it *}
{$title}
]]>
</programlisting>
</example>
</sect1>
<sect1 id="tips.passing.vars">
<title>Passing variable title to header template</title>
<para>
When the majority of your templates use the same headers and footers, it
is common to split those out into their own templates and include them.
But what if the header needs to have a different title, depending on
what page you are coming from? You can pass the title to the header when
it is included.
</para>
<example>
<title>Passing the title variable to the header template</title>
<programlisting>
<![CDATA[
mainpage.tpl
------------
{include file="header.tpl" title="Main Page"}
{* template body goes here *}
{include file="footer.tpl"}
archives.tpl
------------
{config_load file="archive_page.conf"}
{include file="header.tpl" title=#archivePageTitle#}
{* template body goes here *}
{include file="footer.tpl"}
header.tpl
----------
&lt;HTML&gt;
&lt;HEAD&gt;
&lt;TITLE&gt;{$title|default:"BC News"}&lt;/TITLE&gt;
&lt;/HEAD&gt;
&lt;BODY&gt;
footer.tpl
----------
&lt;/BODY&gt;
&lt;/HTML&gt;
]]>
</programlisting>
</example>
<para>
When the main page is drawn, the title of "Main Page" is passed to the
header.tpl, and will subsequently be used as the title. When the
archives page is drawn, the title will be "Archives". Notice in the
archive example, we are using a variable from the archives_page.conf
file instead of a hard coded variable. Also notice that "BC News" is
printed if the $title variable is not set, using the
<emphasis>default</emphasis> variable modifier.
</para>
</sect1>
<sect1 id="tips.dates">
<title>Dates</title>
<para>
As a rule of thumb, always pass dates to Smarty as timestamps. This
allows template designers to use <link
linkend="language.modifier.date.format">date_format</link> for full
control over date formatting, and also makes it easy to compare dates if
necessary.
</para>
<para>
NOTE: As of Smarty 1.4.0, you can pass dates to Smarty as unix
timestamps, mysql timestamps, or any date parsable by strtotime().
</para>
<example>
<title>using date_format</title>
<programlisting>
<![CDATA[
{$startDate|date_format}
OUTPUT:
Jan 4, 2001
{$startDate|date_format:"%Y/%m/%d"}
OUTPUT:
2001/01/04
{if $date1 &lt; $date2}
...
{/if}
]]>
</programlisting>
</example>
<para>
When using {html_select_date} in a template, The programmer will most
likely want to convert the output from the form back into timestamp
format. Here is a function to help you with that.
</para>
<example>
<title>converting form date elements back to a timestamp</title>
<programlisting role="php">
<![CDATA[
// this assumes your form elements are named
// startDate_Day, startDate_Month, startDate_Year
$startDate = makeTimeStamp($startDate_Year,$startDate_Month,$startDate_Day);
function makeTimeStamp($year="",$month="",$day="")
{
if(empty($year))
$year = strftime("%Y");
if(empty($month))
$month = strftime("%m");
if(empty($day))
$day = strftime("%d");
return mktime(0,0,0,$month,$day,$year);
}
]]>
</programlisting>
</example>
</sect1>
<sect1 id="tips.wap">
<title>WAP/WML</title>
<para>
WAP/WML templates require a php Content-Type header to be passed along
with the template. The easist way to do this would be to write a custom
function that prints the header. If you are using caching, that won't
work so we'll do it using the insert tag (remember insert tags are not
cached!) Be sure that there is nothing output to the browser before the
template, or else the header may fail.
</para>
<example>
<title>using insert to write a WML Content-Type header</title>
<programlisting role="php">
<![CDATA[
<?php
// be sure apache is configure for the .wml extensions!
// put this function somewhere in your application, or in Smarty.addons.php
function insert_header($params) {
// this function expects $content argument
if(empty($params['content']))
return;
header($params['content']);
return;
}
?>
]]>
</programlisting>
<para>
your Smarty template <emphasis>must</emphasis> begin with the insert tag :
</para>
<programlisting>
<![CDATA[
{insert name=header content="Content-Type: text/vnd.wap.wml"}
&lt;?xml version="1.0"?&gt;
&lt;!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"&gt;
&lt;!-- begin new wml deck --&gt;
&lt;wml&gt;
&lt;!-- begin first card --&gt;
&lt;card&gt;
&lt;do type="accept"&gt;
&lt;go href="#two"/&gt;
&lt;/do&gt;
&lt;p&gt;
Welcome to WAP with Smarty!
Press OK to continue...
&lt;/p&gt;
&lt;/card&gt;
&lt;!-- begin second card --&gt;
&lt;card id="two"&gt;
&lt;p&gt;
Pretty easy isn't it?
&lt;/p&gt;
&lt;/card&gt;
&lt;/wml&gt;
]]>
</programlisting>
</example>
</sect1>
<sect1 id="tips.componentized.templates">
<title>Componentized Templates</title>
<para>
Traditionally, programming templates into your applications goes as
follows: First, you accumulate your variables within your PHP
application, (maybe with database queries.) Then, you instantiate your
Smarty object, assign the variables and display the template. So lets
say for example we have a stock ticker on our template. We would
collect the stock data in our application, then assign these variables
in the template and display it. Now wouldn't it be nice if you could
add this stock ticker to any application by merely including the
template, and not worry about fetching the data up front?
</para>
<para>
You can do this by writing a custom plugin for fetching the content and
assigning it to a template variable.
</para>
<example>
<title>componentized template</title>
<programlisting role="php">
<![CDATA[
<?php
// function.load_ticker.php
function smarty_function_load_ticker($params, &amp;$smarty) {
// setup our function for fetching stock data
function fetch_ticker($params['symbol']) {
// put logic here that fetches $ticker_info
// from some resource
return $ticker_info;
}
// call the function
$ticker_info = fetch_ticker("YHOO",$ticker_info);
// assign template variable
$smarty->assign($params['assign'],$ticker_info);
}
?>
]]>
</programlisting>
<programlisting>
<![CDATA[
index.tpl
---------
{* Smarty *}
{load_ticker symbol="YHOO" assign="ticker"}
Stock Name: {$ticker.name} Stock Price: {$ticker.price}
]]>
</programlisting>
</example>
</sect1>
<sect1 id="tips.obfuscating.email">
<title>Obfuscating E-mail Addresses</title>
<para>
Do you ever wonder how your E-mail address gets on so many spam mailing
lists? One way spammers collect E-mail addresses is from web pages. To
help combat this problem, you can make your E-mail address show up in
scrambled javascript in the HTML source, yet it it will look and work
correctly in the browser. This is done with the mailto plugin.
</para>
<example>
<title>Example of Obfuscating an E-mail Address</title>
<programlisting>
<![CDATA[
index.tpl
---------
Send inquiries to
{mailto address=$EmailAddress encode="javascript" subject="Hello"}
]]>
</programlisting>
</example>
<note>
<title>Technical Note</title>
<para>
This method isn't 100% foolproof. A spammer could conceivably program his
e-mail collector to decode these values, but not likely.
</para>
</note>
</sect1>
</chapter>
<chapter id="resources">
<title>Resources</title>
<para>
Smarty's homepage is located at http://smarty.php.net/.
You can join the mailing list by sending an e-mail to
smarty-general-subscribe@lists.php.net. An archive of the mailing list can be
viewed at http://marc.theaimsgroup.com/?l=smarty&amp;r=1&amp;w=2
</para>
</chapter>
<chapter id="bugs">
<title>BUGS</title>
<para>
Check the BUGS file that comes with the latest distribution of Smarty, or
check the website.
</para>
</chapter>
</part>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,46 +0,0 @@
;; -*- Scheme -*-
;;
;; $Id$
;;
;; This file contains stylesheet customization common to the HTML
;; and print versions.
;;
;; Stylesheets Localization
(define %default-language% "en")
(define %use-id-as-filename% #t)
(define %gentext-nav-tblwidth% "100%")
(define %refentry-function% #t)
(define %refentry-generate-name% #f)
(define %funcsynopsis-style% 'ansi)
(define ($legalnotice-link-file$ legalnotice)
(string-append "copyright" %html-ext%))
(define %generate-legalnotice-link% #t)
(define %footnotes-at-end% #t)
(define %force-chapter-toc% #t)
(define newline "\U-000D")
(define %number-programlisting-lines% #f)
(define %linenumber-mod% 1)
(define %shade-verbatim% #t)
(define ($generate-book-lot-list$)
;; REFENTRY generate-book-lot-list
;; PURP Which Lists of Titles should be produced for Books?
;; DESC
;; This parameter should be a list (possibly empty) of the elements
;; for which Lists of Titles should be produced for each 'Book'.
;;
;; It is meaningless to put elements that do not have titles in this
;; list. If elements with optional titles are placed in this list, only
;; the instances of those elements that do have titles will appear in
;; the LOT.
;;
;; /DESC
;; AUTHOR N/A
;; /REFENTRY
(list (normalize "table")))
(define (php-code code)
(make processing-instruction
data: (string-append "php " code "?")))

File diff suppressed because it is too large Load Diff

View File

@@ -1,382 +0,0 @@
;; -*- Scheme -*-
;;
;; $Id$
;;
;; Returns the depth of the auto-generated TOC (table of contents) that
;; should be made at the nd-level
(define (toc-depth nd)
(if (string=? (gi nd) (normalize "book"))
3 ; the depth of the top-level TOC
1 ; the depth of all other TOCs
))
(element (funcdef function)
($bold-seq$
(make sequence
(process-children)
)
)
)
(define (is-true-optional nl)
(and (equal? (gi (parent nl)) (normalize "parameter"))
(equal? 0 (string-length (strip (data (preced nl)))))
(equal? 0 (string-length (strip (data (follow nl)))))
)
)
(define (has-true-optional nl)
(is-true-optional
(node-list-first-element
(select-elements
(descendants nl)
(normalize "optional"))
)
)
)
(define (count-true-optionals nl)
(let loop
((result 0)
(nl (select-elements (descendants nl) (normalize "optional")))
)
(if(node-list-empty? nl)
result
(if(is-true-optional(node-list-first nl))
(loop (+ result 1) (node-list-rest nl))
(loop result (node-list-rest nl))
)
)
)
)
;; there are two different kinds of optionals
;; optional parameters and optional parameter parts
;; an optional parameter is identified by an optional tag
;; with a parameter tag as its parent
;; and only whitespace between them
(element optional
;;check for true optional parameter
(if (is-true-optional (current-node))
;; yes - handle '[...]' in paramdef
(process-children-trim)
;; no - do '[...]' output
(make sequence
(literal %arg-choice-opt-open-str%)
(process-children-trim)
(literal %arg-choice-opt-close-str%)
)
)
)
;; now this is going to be tricky
(element paramdef
(make sequence
;; special treatment for first parameter in funcsynopsis
(if (equal? (child-number (current-node)) 1)
;; is first ?
(make sequence
;; start parameter list
(literal "(")
;; is optional ?
( if (has-true-optional (current-node))
(literal %arg-choice-opt-open-str%)
(empty-sosofo)
)
)
;; not first
(empty-sosofo)
)
;;
(process-children-trim)
;; special treatment for last parameter
(if (equal? (gi (ifollow (current-node))) (normalize "paramdef"))
;; more parameters will follow
(make sequence
;; next is optional ?
( if (has-true-optional (ifollow (current-node)))
;; optional
(make sequence
(literal " ")
(literal %arg-choice-opt-open-str%)
)
;; not optional
(empty-sosofo)
)
(literal ", " )
)
;; last parameter
(make sequence
(literal
(let loop ((result "")(count (count-true-optionals (parent (current-node)))))
(if (<= count 0)
result
(loop (string-append result %arg-choice-opt-close-str%)(- count 1))
)
)
)
( literal ")" )
)
)
)
)
(element function
(let* ((function-name (data (current-node)))
(linkend
(string-append
"function."
(string-replace
(string-replace function-name "_" "-")
"::" ".")))
(target (element-with-id linkend))
(parent-gi (gi (parent))))
(cond
;; function names should be plain in FUNCDEF
((equal? parent-gi "funcdef")
(process-children))
;; if a valid ID for the target function is not found, or if the
;; FUNCTION tag is within the definition of the same function,
;; make it bold, add (), but don't make a link
((or (node-list-empty? target)
(equal? (case-fold-down
(data (node-list-first
(select-elements
(node-list-first
(children
(select-elements
(children
(ancestor-member (parent) (list "refentry")))
"refnamediv")))
"refname"))))
function-name))
($bold-seq$
(make sequence
(process-children)
(literal "()"))))
;; else make a link to the function and add ()
(else
(make element gi: "A"
attributes: (list
(list "HREF" (href-to target)))
($bold-seq$
(make sequence
(process-children)
(literal
)
(literal "()"))))))))
(element command
(let* ((command-name (data (current-node)))
(linkend
(string-append
"language.function."
(string-replace
(string-replace command-name "_" ".")
"::" ".")))
(target (element-with-id linkend))
(parent-gi (gi (parent))))
(cond
;; function names should be plain in FUNCDEF
((equal? parent-gi "funcdef")
(process-children))
;; if a valid ID for the target function is not found, or if the
;; FUNCTION tag is within the definition of the same function,
;; make it bold, add (), but don't make a link
((or (node-list-empty? target)
(equal? (case-fold-down
(data (node-list-first
(select-elements
(node-list-first
(children
(select-elements
(children
(ancestor-member (parent) (list "refentry")))
"refnamediv")))
"refname"))))
command-name))
($bold-seq$
(make sequence
(literal "{")
(process-children)
(literal "}"))))
;; else make a link to the function and add ()
(else
(make element gi: "A"
attributes: (list
(list "HREF" (href-to target)))
($bold-seq$
(make sequence
(literal "{")
(process-children)
(literal "}"))))))))
(element classname
(let* ((class-name (data (current-node)))
(linkend
(string-append
"class."
(string-replace
(case-fold-down class-name) "_" "-")))
(target (element-with-id linkend))
(parent-gi (gi (parent))))
(cond
;; function names should be plain in SYNOPSIS
((equal? parent-gi "synopsis")
(process-children))
;; if a valid ID for the target class is not found, or if the
;; CLASSNAME tag is within the definition of the same class,
;; make it bold, but don't make a link
((or (node-list-empty? target)
(equal? (case-fold-down
(data (node-list-first
(select-elements
(node-list-first
(children
(select-elements
(children
(ancestor-member (parent) (list "refentry")))
"refnamediv")))
"refname"))))
class-name))
($bold-seq$
(process-children)))
;; else make a link to the function and add ()
(else
(make element gi: "A"
attributes: (list
(list "HREF" (href-to target)))
($bold-seq$
(process-children)))))))
(element constant
(let* ((constant-name (data (current-node)))
(linkend
(string-append "constant."
(case-fold-down
(string-replace constant-name "_" "-"))))
(target (element-with-id linkend))
(parent-gi (gi (parent))))
(cond
; ;; constant names should be plain in FUNCDEF
; ((equal? parent-gi "funcdef")
; (process-children))
;; if a valid ID for the target constant is not found, or if the
;; CONSTANT tag is within the definition of the same constant,
;; make it bold, add (), but don't make a link
((or (node-list-empty? target)
(equal? (case-fold-down
(data (node-list-first
(select-elements
(node-list-first
(children
(select-elements
(children
(ancestor-member (parent) (list "refentry")))
"refnamediv")))
"refname"))))
constant-name))
($bold-mono-seq$
(process-children)))
;; else make a link to the function and add ()
(else
(make element gi: "A"
attributes: (list
(list "HREF" (href-to target)))
($bold-mono-seq$
(process-children)))))))
(element example
(make sequence
(make element gi: "TABLE"
attributes: (list
(list "WIDTH" "100%")
(list "BORDER" "0")
(list "CELLPADDING" "0")
(list "CELLSPACING" "0")
(list "CLASS" "EXAMPLE"))
(make element gi: "TR"
(make element gi: "TD"
($formal-object$))))))
(element (paramdef parameter)
(make sequence
font-posture: 'italic
(process-children-trim)
)
)
(mode book-titlepage-recto-mode
(element authorgroup
(process-children))
(element author
(let ((author-name (author-string))
(author-affil (select-elements (children (current-node))
(normalize "affiliation"))))
(make sequence
(make element gi: "DIV"
attributes: (list (list "CLASS" (gi)))
(literal author-name))
(process-node-list author-affil))))
)
(define (chunk-element-list)
(list (normalize "preface")
(normalize "chapter")
(normalize "appendix")
(normalize "article")
(normalize "glossary")
(normalize "bibliography")
(normalize "index")
(normalize "colophon")
(normalize "setindex")
(normalize "reference")
(normalize "refentry")
(normalize "part")
(normalize "sect1")
(normalize "sect2")
(normalize "section")
(normalize "book") ;; just in case nothing else matches...
(normalize "set") ;; sets are definitely chunks...
))
(define ($section-body$)
(make element gi: "DIV"
attributes: (list (list "CLASS" (gi)))
($section-separator$)
($section-title$)
(if (or (not (node-list-empty? (select-elements (children (current-node))
(normalize "sect2"))))
(not (node-list-empty? (select-elements (children (current-node))
(normalize "sect3")))))
(build-toc (current-node) 1)
(empty-sosofo))
(process-children)))

View File

@@ -1,35 +0,0 @@
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
<!ENTITY preface SYSTEM "preface.sgml">
<!ENTITY getting.started SYSTEM "getting-started.sgml">
<!ENTITY smarty.for.designers SYSTEM "designers.sgml">
<!ENTITY smarty.for.programmers SYSTEM "programmers.sgml">
<!ENTITY appendixes SYSTEM "appendixes.sgml">
]>
<book id="index">
<bookinfo id="bookinfo">
<title>Smarty - the compiling PHP template engine</title>
<authorgroup id="authors">
<author>
<firstname>Monte</firstname><surname>Ohrt &lt;monte@ispi.net&gt;</surname>
</author>
<author>
<firstname>Andrei</firstname><surname>Zmievski &lt;andrei@php.net&gt;</surname>
</author>
</authorgroup>
<edition>Version 2.0</edition>
<copyright>
<year>2001</year>
<year>2002</year>
<year>2003</year>
<holder>ispi of Lincoln, Inc.</holder>
</copyright>
</bookinfo>
&preface;
&getting.started;
&smarty.for.designers;
&smarty.for.programmers;
&appendixes;
</book>

View File

@@ -1,21 +0,0 @@
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY docbook.dsl SYSTEM "/usr/share/sgml/docbook/dsssl-stylesheets/html/docbook.dsl" CDATA DSSSL>
<!ENTITY html-common.dsl SYSTEM "html-common.dsl">
<!ENTITY common.dsl SYSTEM "common.dsl">
]>
<style-sheet>
<style-specification id="docbook-smarty-html" use="docbook">
<style-specification-body>
(define %html-ext% ".php")
&html-common.dsl;
&common.dsl;
</style-specification-body>
</style-specification>
<external-specification id="docbook" document="docbook.dsl">
</style-sheet>

View File

@@ -1,90 +0,0 @@
<preface id="preface">
<title>Preface</title>
<para>
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.
</para>
<para>
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.
</para>
<para>
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.
</para>
<para>
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
<productname>SmartTemplate</productname> 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?
</para>
<para>
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...
</para>
</preface>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

File diff suppressed because it is too large Load Diff