method renderer documentation in bbn\Tpl

Generates a Mustache template function ready to receive parameters and returns it.

A temporary file is created if it does not already exists.

function(string $st) { if (\defined('BBN_DATA_PATH')) { $dir = File\Dir::createPath(BBN_DATA_PATH.'tmp/bbn-templates'); } else { $dir = File\Dir::createPath(sys_get_temp_dir().'/bbn-templates'); } if (!$dir) { throw new \Exception(X::_("Impossible to create the template directory")); } $md5 = md5($st); $file = $dir.'/tpl.'.$md5.'.php'; if (!file_exists($file)) { $tpl = LightnCandy::compile( $st, [ 'flags' => LightnCandy::FLAG_MUSTACHELOOKUP | LightnCandy::FLAG_PARENT | LightnCandy::FLAG_HANDLEBARSJS | LightnCandy::FLAG_ERROR_LOG ] ); file_put_contents($file, ''); } return include($file); }

Generates a Mustache template function ready to receive parameters and returns it. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.