-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include partial files #312
Comments
From your provided information you should using old version of lightncandy or other frameworks based on lightncandy. for older version document you may check here: https://github.com/zordius/lightncandy/tree/v0.23 . And in your stack trace there are something like |
Hi @zordius, |
I've done clean deploy on my dev box (CentOS 7, PHP 5.6.40) from here: https://github.com/zordius/lightncandy/tree/master/src This is my folder structure (maybe I'm missing something): In {{> header }}
MAIN TEMPLATE {{ test }} Content of my index.php file is: <?php
require_once( './src/loader.php' );
use LightnCandy\LightnCandy;
$template = file_get_contents( './main.hbs' );
$config_template = array(
'flags' => LightnCandy::FLAG_HANDLEBARSJS | LightnCandy::FLAG_SPVARS | LightnCandy::FLAG_INSTANCE | LightnCandy::FLAG_ERROR_EXCEPTION,
'basedir' => Array([
'./',
'./partials'
]),
'fileext' => Array([
'.hbs'
])
);
$phpStr = LightnCandy::compile($template, $config_template);
file_put_contents( './cache/cache_' . $cacheName . '.php', '<?php ' . $phpStr . '?>');
$renderer = include( './cache/cache_' . $cacheName . '.php' );
$data = array(
'test' => 'TEST'
);
echo $renderer( $data ); Same error still persist:
When I remove Many thanks for any help. |
for lightncandy 0.23 partials should be provided by code but not another file, please read document here: https://github.com/zordius/lightncandy/tree/v0.23#partial-support , and do the file loading task yourself. |
Hello. My problem is the same, but in a more specific context. I don't want to modify any lightncandy file. (easy updates, bigger code time life). I will try to extends the LightnCandy main class to override compile and compilePartial methods. By design, the first parameter of theses methods is directly the template string. I hope this won't enter in conflict with any part of lightncandy library, and this can be an helpful idea for anyone. Thanks |
Oops. |
Compiler::partial() method use Partial::compileStatic(). Would you like me to post a new feature ticket, or it's ok with this one? |
Do you mean to use v0.23 ? Or current version? |
Hello there!
I'm not sure if I'm missing something, but I cannot include partials...
So I have my default.hbs file and there I'm trying to include my header:
file is located in ./partials/header.hbs and my config for lightncandy is following:
I've got this error and I'm not sure what I'm doing wrong:
Please help,
Many thanks in advance.
Peter.
The text was updated successfully, but these errors were encountered: