PHP (http://www.php.net/) is one of the few scripting languages
expressly designed for web servlets. However, it's also a full-fledged
programming language with libraries similar to Python's and Perl's. The
syntax and functions are like a cross between Perl and C plus some original
ideas (e.g.; a single array type serves as both a list and a dictionary,
$arr="value"; appends to an array).
Smarty (http://smarty.php.net/) is an advanced template engine for PHP. (Note: this comparision is based on Smarty's on-line documentation. The author has not used Smarty. Please send corrections or ommissions to the Cheetah mailing list.) Like Cheetah, Smarty:
Features Smarty has that Cheetah lacks:
-as the input file name and
--stdoutto send the result to standard output. Note that Cheetah uses the term ``output filter'' differently than Smarty: Cheetah output filters (
#filter) operate on placeholders, while Smarty output filters operate on the entire template output. There has been a proposed
#seddirective that would operate on the entire output line by line, but it has not been implemented.
.replace(SEARCH, REPL)), but in other cases you must wrap the result in a function call or write a custom output filter (
#extends. Part of this is because Cheetah distinguishes between functions and directives, while Smarty treats them all as ``functions''. Cheetah's design does not allow functions to have flow control effect outside the function (e.g.,
#for, which operate on template body lines), so directives like these cannot be encoded as functions.
Cheetah.SettingsManagermodule can parse such a file, but you'd have to invoke it manually. (See the docstrings in the module for details.) In Smarty, this feature is used for multilingual applications. In Cheetah, the developers maintain that everybody has their own preferred way to do this (such as using Python's
gettextmodule), and it's not worth blessing one particular strategy in Cheetah since it's easy enough to integrate third-party code around the template, or to add the resulting values to the searchList.
Features Cheetah has that Smarty lacks:
Comparisions of various Smarty constructs:
Some of these modifiers could be added to the super output filter we want to write someday.