10 lis 2017

Przykład uruchomienia smartów

require_once('/app/config.php');
require_once('/app/smarty-3.1.29/libs/Smarty.class.php');

$smarty=new Smarty;
$smarty->template_dir = '/app/templates/';
$smarty->compile_dir = '/app/data/smarty/templates_c/';
$smarty->cache_dir = '/app/data/smarty/cache/';
$smarty->config_dir = '/app/data/smarty/config/';
$smarty->caching= false;
$smarty->force_compile=true;
//$smarty->force_compile=false;
$smarty->configLoad('pl.conf', 'index');
$smarty->left_delimiter = '!{';
$smarty->right_delimiter = '}!';

$data_to_send=$smarty->fetch('index.html');

header("Connection: close");
ignore_user_abort(true);
header('Content-type: text/html; charset='.$config['encoding']);
header("Content-Length: ".mb_strlen($data_to_send, $config['encoding']));

echo $data_to_send;