Giter VIP home page Giter VIP logo

Comments (3)

Stricted avatar Stricted commented on July 18, 2024

no problem here
{if !$smarty.const.ENABLE_DEBUG}.min{/if}

.min

from smarty.

Gemorroj avatar Gemorroj commented on July 18, 2024

The problem appears if the constant is not defined.

index.php

<?php

require __DIR__ . '/smarty-3.1.23/libs/Smarty.class.php';

// !!!
//define('TEST_CONST', false);

class Template extends Smarty
{
    public function __construct()
    {
        parent::__construct();

        $this->setTemplateDir(__DIR__ . '/templates/')
            ->setCompileDir(__DIR__ . '/templates_c/')
            ->setConfigDir(__DIR__ . '/configs/')
            ->setCacheDir(__DIR__ . '/cache/');

        $this->compile_check = true;
        //$this->default_modifiers = array('escape:"htmlall"');
    }

}


$obj = new Template();
$obj->display('test.tpl');

templates/test.tpl

{if $smarty.const.TEST_CONST === true}
    success
{/if}

render ok

from smarty.

Stricted avatar Stricted commented on July 18, 2024

ok now i can confirm that
{if $smarty.const.TEST_CONST === true}success{/if}
compiled to

success

Parse error: syntax error, unexpected 'TEST_CONST' (T_STRING) in

i think its better to check with defined() previously if the constant is exist

from smarty.

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.