zordius / lightncandy

An extremely fast PHP implementation of handlebars ( http://handlebarsjs.com/ ) and mustache ( http://mustache.github.io/ ),
https://zordius.github.io/HandlebarsCookbook/
MIT License
610 stars 76 forks source link

Hi...broken forum link #352

Closed Tolumercy closed 3 years ago

Tolumercy commented 3 years ago

The PHP Code:

require('./vendor/autoload.php');
use LightnCandy\LightnCandy;

// The Template:
$template = <<<VAREND
put template with issues here...
VAREND;

// Helpers:
$helpers = array(
  'foo' => function () {
    return 'Hello World';
  },
);

// Partials:
$partials = array(
    'bar' => 'Yes, partial',
);

$phpStr = LightnCandy::compile($template, array(
  // Used compile flags
  'flags' => LightnCandy::FLAG_ERROR_EXCEPTION | LightnCandy::FLAG_HANDLEBARS,
  'helpers' => $helpers,
  'partials' => $partials,
));

echo "Generated PHP Code:\n$phpStr\n";

// Input Data:
$data = array(
  'qoo' => 'moo'
);

// Save the compiled PHP code into a php file
file_put_contents('render.php', '<?php ' . $phpStr . '?>');

// Get the render function from the php file
$renderer = include('render.php');

echo "Result:\n" . $renderer($data);

The Issue:

Describe your issue or question here... I have no idea how to do these code thingys, or I'd write out my request in a code manner. I found some links you posted in forum, and I joined the platform so I could communicate directly with you on there to no avail. It's a book I have searched everywhere for and I couldn't find until I came across your link on forum, but I couldn't access it at all. This is my last attempt, please help me. I have messaged you on linkedin, tried to make a post on forum, but nothing. Kindly help please. It's Pilgrim's progress in Pictures by Rev Ralph Kirby Thanks in anticipation of your help.