README
About Kwartz-php
Kwartz-php is a template system which is available with multi language (PHP, Ruby and JSP).
And, it is the first template system which realized the concept of 'Separation of Presentation Logic and Presentaion data' (SoPL/PD).
Features:
- Separates presentation logic from presentation data.
- Runs very fast.
- Support multiple programing languages (PHP, Ruby, Java).
- Doesn't break HTML design at all.
- Can handle any text file.
- Support Auto-Sanitizing and Partial-Sanitizing.
Example
- Presentation Data (example.html)
-
There is no iteration nor conditional branching
in the presentation data file.
<table> <tr id="values"> <td>@{$var}@</td> </tr> </table>
- Presentation Logic (example.plogic)
-
There is no HTML tags in the presentation logic file.
## Re-define an element element values { ## element foreach ($list as $var) { @stag; ## start tag @cont; ## content @etag; ## end tag } }
- Compile
-
Generate an output script from presentation data and presentation
logic.
$ kwartz-php -p example.plogic example.html > example.php $ kwartz-php -l eruby -p example.plogic example.html > example.rhtml $ kwartz-php -l jstl11 -p example.plogic example.html > example.jsp
- Output Script
-
(PHP)
<table> <?php foreach ($list as $var) { ?> <tr id="values"> <td><?php echo $var; ?></td> </tr> <?php } ?> </table>(eRuby)
<table> <% for var in list do %> <tr id="values"> <td><%= var %></td> </tr> <% end %> </table>(JSTL)
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <table> <c:forEach var="var" items="${list}"> <tr id="values"> <td><c:out value="${var}" escapeXml="false"/></td> </tr> </c:forEach> </table>
Installation
Kwartz-php requires PHP 5. You have to install PHP 5 to use Kwartz-php.
The following shows how to install Kwartz-php.
- Unzip the 'download.zip' file. You'll get KwartzPHP-0.3.0.tgz.
- Install the KwartzPHP-0.3.0.tgz with pear installer.
$ su - # pear install KwartzPHP-0.3.0.tgz
Or you can install it manually.### Unarchive the KwartzPHP-0.3.0.tgz $ tar xzf KwartzPHP-0.3.0.tgz $ cd KwartzPHP*/ ### copy library files $ cp -a Kwartz.php Kwartz /usr/local/lib/php ### copy command script $ cp -a kwartz-php mkmethod-php /usr/local/bin
Documents
See Users' Guide (2.html) and Reference Manual (3.html) for details.
License
Copyright (C) 2004 kuwata-lab All rights reserved.
This software is under GNU GPL.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details..



