On 23-04-2009 at 02:17:50 Jason La <jaso...@gmail.com> wrote:

Is possible to store templates in a database instead of the file
system, and how would I go about doing that?

You can use PHPTAL->setSource() in current stable release.

In version 1.2.0 you can create your own SourceResolver class which will load 
templates on demand, e.g:

class MyDBSource extends PHPTAL_SourceResolver
 public function resolve($path)
    $result = database_fetch_one_row("SELECT source FROM templates WHERE path = 
?", $path);
    if ($result)
       return new PHPTAL_StringSource($result['source'], $path);
    return null;

$phptal->addSourceResolver(new MyDBSource());

regards, Kornel

PHPTAL mailing list

Reply via email to