LightnCandy option: FLAG_ELSE

Resolve {{else}} or {{^}} as handlebars specification. Otherwise, {{else}} will be resolved as normal variable, and {{^}} will cause template error.

Sample Codes

The default behavior: {{else}} will look for the value of 'else' key.

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

$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
  "else" => "OK"
);
echo $render($data);
Data:
array(
  "foo" => true
)
Template:
{{#if foo}}FOO{{else}}BAR{{/if}}
Result:
FOOBAR
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{#if foo}}FOO{{else}}BAR{{/if}}";

$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
  "foo" => true
);
echo $render($data);

{else}}will do the else logic when FLAG_ELSE enabled.

Used option: FLAG_ELSE

Data:
array(
  "foo" => true
)
Template:
{{#if foo}}FOO{{else}}BAR{{/if}}
Result:
FOO
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{#if foo}}FOO{{else}}BAR{{/if}}";

$php = LightnCandy::compile($template, array(
  "flags" => LightnCandy::FLAG_ELSE
));
$render = LightnCandy::prepare($php);
$data = array(
  "foo" => true
);
echo $render($data);