{
    "href": "/post/2004/10/19/savant-version-230-now-available/",
    "relId": "2004/10/19/savant-version-230-now-available",
    "title": "Savant version 2.3.0 now available",
    "author": "pmjones",
    "markup": "html",
    "tags": [
        {
            "href": "/tag/php/",
            "relId": "php",
            "title": "PHP",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        }
    ],
    "created": "2004-10-19 16:32:25 UTC",
    "updated": [
        "2004-10-19 16:32:25 UTC"
    ],
    "html": "<p>I just released <a href=\"http://phpsavant.com\">Savant version 2.3.0</a>.</p>\n<p>Normally, if you want to use a template plugin, you call the plugin() method like so:</p>\n<pre><code>&lt;?php $this-&gt;plugin('myPlug', $arg1, $arg2); ?&gt;</code></pre>\n<p>Through the magic of the overload() function in PHP and the __call() magic method, you can call plugins as if they were native Savant2 methods.</p>\n<pre><code>&lt;?php $this-&gt;myPlug($arg1, $arg2); ?&gt;</code></pre>\n<p>This should make for a little less typing and a little easier reading.  For example, to generate a form with Savant2 using the 'form' plugin, you can now do something like this:</p>\n<pre><code>&lt;?php\n//\n// start the form\n$this-&gt;form('start');\n//\n// add a text field and label\n$this-&gt;form('text', 'myTextField', 'default value',\n    'Text field label:');\n//\n// add save and reset buttons as a group\n$this-&gt;form('group', 'start', 'Group label:');\n$this-&gt;form('submit', 'op', 'Save');\n$this-&gt;form('reset', 'op', 'Reset');\n$this-&gt;form('group', 'end');\n//\n// end the form\n$this-&gt;form('end');\n?&gt;</code></pre>\n<p>(Indicentally, the 'form' plugin is pretty powerful; it support all standard field elements, handles layout, and generates valid XHTML with divs, labels, fieldsets, and tables.  Check out the documentation for the 'form' plugin <a href=\"http://phpsavant.com/yawiki/index.php?page=PluginForm\">here</a>.)</p>\n<p><a href=\"http://phpsavant.com\">Savant</a> is an object-oriented template system for PHP.  Savant does not compile templates; instead, you write your templates as regular PHP scripts, so there's no new markup to learn.  As such, Savant is a simple, elegant, and powerful alternative to Smarty.</p>\n<p><b>UPDATE:</b> (19:24 central time) There appears to be a problem with PHP5 and the __call() method in Savant 2.3.0.  Users of PHP will want to test before using 2.3.0.  I am working on a patch so that __call() works in Savant2 for both PHP4 and PHP5 transparently, and will blog about the solution at that time.  Thanks for your patience.</p>\n"
}
