Code Monkey home page Code Monkey logo

Comments (4)

zordius avatar zordius commented on May 25, 2024

I just add tests for this issue, I can not reproduce this issue. May you test on current master version again or provide sample code? thanks.

from lightncandy.

andr2k avatar andr2k commented on May 25, 2024

Here is the code:

<?php
require 'lightncandy.php';
$template = '{{#with items}}

{{/with}}';

$tplString = \LightnCandy::compile($template, [\LightnCandy::FLAG_WITH]);
print_r(\LightnCandy::getContext());
?>

from lightncandy.

andr2k avatar andr2k commented on May 25, 2024

Result:

Array
(
    [flags] => Array
        (
            [errorlog] => 0
            [exception] => 0
            [skippartial] => 0
            [standalone] => 0
            [jstrue] => 0
            [jsobj] => 0
            [jsquote] => 0
            [this] => 0
            [with] => 0
            [parent] => 0
            [echo] => 16384
            [advar] => 0
            [namev] => 0
            [spvar] => 0
            [slash] => 0
            [else] => 0
            [exhlp] => 0
            [mustsp] => 0
            [mustlok] => 0
            [mustpi] => 0
            [debug] => 0
            [prop] => 0
            [method] => 0
            [runpart] => 0
        )

    [level] => 0
    [stack] => Array
        (
            [0] => ['with']
        )

    [error] => Array
        (
            [0] => Unexpect token /with !
        )

    [basedir] => Array
        (
            [0] => /home/a/projects/csr/protected/vendor/zordius/lightncandy/src
        )

    [fileext] => Array
        (
            [0] => .tmpl
        )

    [tokens] => Array
        (
            [ahead] => 
            [current] => 2
            [count] => 2
            [startchar] => {
            [left] => {{
            [right] => }}
            [search] => /^(.*?)(\s*)(\{{2,3})(~?)([\^#\/!&>]?)(.*?)(~?)(\}{2,3})(\s*)(.*)$/s
        )

    [usedPartial] => Array
        (
        )

    [partialStack] => Array
        (
        )

    [partialCode] => 
    [usedFeature] => Array
        (
            [rootthis] => 0
            [enc] => 0
            [raw] => 0
            [sec] => 1
            [isec] => 0
            [if] => 0
            [else] => 0
            [unless] => 0
            [each] => 0
            [this] => 0
            [parent] => 0
            [with] => 0
            [dot] => 0
            [comment] => 0
            [partial] => 0
            [helper] => 0
            [bhelper] => 0
            [hbhelper] => 0
            [delimiter] => 0
        )

    [usedCount] => Array
        (
            [var] => Array
                (
                )

            [helpers] => Array
                (
                )

            [blockhelpers] => Array
                (
                )

            [hbhelpers] => Array
                (
                )

            [lcrun] => Array
                (
                    [sec] => 1
                )

        )

    [helpers] => Array
        (
        )

    [blockhelpers] => Array
        (
        )

    [hbhelpers] => Array
        (
        )

    [ops] => Array
        (
            [seperator] => ,
            [f_start] => echo 
            [f_end] => ;
            [op_start] => ob_start();echo 
            [op_end] => ;return ob_get_clean();
            [cnd_start] => ;if 
            [cnd_then] => {echo 
            [cnd_else] => ;}else{echo 
            [cnd_end] => ;}echo 
            [enc] => enc
        )

)

PHP version

php -v
PHP 5.5.9-1ubuntu4.3 (cli) (built: Jul  7 2014 16:36:58) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

from lightncandy.

zordius avatar zordius commented on May 25, 2024

There is a small wrong place in your code, try this:

$tplString = \LightnCandy::compile($template, Array('flags' => LightnCandy::FLAG_WITH));

Then it works well. But, there is still one bug when compile without LightnCandy::FLAG_WITH , I will fix it later.

from lightncandy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.