-
Notifications
You must be signed in to change notification settings - Fork 56
Documentation for PHP developers
mochja edited this page Feb 13, 2013
·
5 revisions
RainTPL 3 require PHP > 5.3 to run. The best way to install RainTPL is with Composer, but you can also download it and run one example.
-
Install composer https://github.com/composer/composer
-
Create a composer.json inside your application folder:
{ "require": { "rain/raintpl": ">=3.0.0" } }
-
Open the command line and run the following:
$ php composer.phar install
-
Now create an index.php file and require the autoload.php of Composer:
<?php
require "vendor/autoload.php";
- Use the RainTPL name space:
use Rain\Tpl;
- Configure RainTPL:
$config = array(
"tpl_dir" => "vendor/rain/raintpl/templates/test/",
"cache_dir" => "vendor/rain/raintpl/cache/"
);
Tpl::configure( $config );
- Init, assign and draw the template:
$t = new Tpl;
$t->assign('title','Hello!');
$t->draw('test');