Closed fdorantesm closed 7 years ago
The following code will works on default mode ('expressionLanguage' => 'auto'
or 'expressionLanguage' => 'php'
in options):
colors = ["green","red","aqua","sky","blue"]
each item in [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
p= $colors[$item]
Else you can do this on js expression mode:
The following code will works on default mode ('expressionLanguage' => 'js'
)
- var colors = ["green","red","aqua","sky","blue"]
each item in [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
p= colors[item]
Does it do the trick for you?
Fatal error appears after expression change:
Fatal error: Uncaught exception 'JsPhpize\Parser\Exception' with message 'Unexpected . in on line 1 near from "" .' in C:\localhost\htdocs\comercial\vendor\js-phpize\js-phpize\src\JsPhpize\Parser\TokenCrawler.php:40 Stack trace: #0 C:\localhost\htdocs\comercial\vendor\js-phpize\js-phpize\src\JsPhpize\Parser\Parser.php(322): JsPhpize\Parser\TokenCrawler->unexpected(Object(JsPhpize\Lexer\Token)) #1 C:\localhost\htdocs\comercial\vendor\js-phpize\js-phpize\src\JsPhpize\Parser\Parser.php(343): JsPhpize\Parser\Parser->parseInstructions(Object(JsPhpize\Nodes\Main)) #2 C:\localhost\htdocs\comercial\vendor\js-phpize\js-phpize\src\JsPhpize\Parser\Parser.php(351): JsPhpize\Parser\Parser->parseBlock(Object(JsPhpize\Nodes\Main)) #3 C:\localhost\htdocs\comercial\vendor\js-phpize\js-phpize\src\JsPhpize\JsPhpize.php(52): JsPhpize\Parser\Parser->parse() #4 C:\localhost\htdocs\comercial\vendor\js-phpize\js-phpize\src\JsPhpize\JsPhpize.php(86): JsPhpize\JsPhpize->compile('"" . '#' . "spe...', 'source.js') #5 [internal function]: JsPhpize\J in C:\localhost\htdocs\comercial\vendor\pug-php\pug\src\Jade\Compiler\Visitor.php on line 52
That appears in basic template: doctype html head title test body
Hi, can you give me the complete pug file with indent or try to reproduce the exception on http://pug-demo.herokuapp.com/
Thanks,
As the last error you mention is not linked to the issue title and would probably be solved with last js-phpize release, I close this issue. Please open a new one with more specific context if this error occurs again with last version.
Hi, im trying to get index value on each but get:
Message: Use of undefined constant index - assumed 'index'
My code:
I tried to create var using
- var
,- name
andname =
but i can't get it.Is this possible?