LightnCandy option: FLAG_RENDER_DEBUG

Generate debug template to show error when rendering. With this flag, the performance of rendering may be slowed.

Sample Codes

Compile template to debug version, output HTML error hint for browser when variable not found.

Used option: FLAG_RENDER_DEBUG

Data:
NULL
Template:
OK!{{foo}}
Result:
OK!<!--MISSED((-->{{[foo]}}<!--))-->
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "OK!{{foo}}";

$php = LightnCandy::compile($template, array(
  "flags" => LightnCandy::FLAG_RENDER_DEBUG
));
$render = LightnCandy::prepare($php);
$data = NULL;
echo $render($data, array(
  "debug" => \LightnCandy\Runtime::DEBUG_TAGS_HTML
));

Compile template to debug version, output ANSI error hint for terminal when variable not found.

Used option: FLAG_RENDER_DEBUG

Data:
NULL
Template:
OK!{{foo}}
Result:
OK!{{[foo]}}
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "OK!{{foo}}";

$php = LightnCandy::compile($template, array(
  "flags" => LightnCandy::FLAG_RENDER_DEBUG
));
$render = LightnCandy::prepare($php);
$data = NULL;
echo $render($data, array(
  "debug" => \LightnCandy\Runtime::DEBUG_TAGS_ANSI
));

Compile template to debug version, output to PHP error log when variable not found.

Used option: FLAG_RENDER_DEBUG

Data:
NULL
Template:
OK!{{foo}}
Result:
OK!
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "OK!{{foo}}";

$php = LightnCandy::compile($template, array(
  "flags" => LightnCandy::FLAG_RENDER_DEBUG
));
$render = LightnCandy::prepare($php);
$data = NULL;
echo $render($data, array(
  "debug" => \LightnCandy\Runtime::DEBUG_ERROR_LOG
));

See Also...