pug-php / pug

Pug template engine for PHP
https://www.phug-lang.com
MIT License
391 stars 42 forks source link

Multiple conditionals not working correctly #72

Closed stefanatg2 closed 7 years ago

stefanatg2 commented 8 years ago

&& statements not working properly. PugGlobals are used.

if entryopen and !submitted
    button

but nested

if entryopen
    if submitted == false
        button

works.

kylekatarnls commented 8 years ago

Hi,

For the moment, you have to call the variables with the PHP dollar in such conditions:

if $entryopen and !$submitted
  button
kylekatarnls commented 7 years ago

Hi, if entryopen and !submitted is not possible because it's neither valid PHP nor valid JS, but you can now (by upgrading to the last version) use:

$pug = new Pug(array('expressionLanguage' => 'js'));

with:

if entryopen && !submitted
    button

Or:

$pug = new Pug(array('expressionLanguage' => 'php'));

with:

if $entryopen and !$submitted
    button

PS: && is also available in PHP mode.