Open dessaya opened 10 years ago
But what happen if you do foreach($array[0] as $subArray) ? And if you have not PHP 5.4, so use directly the array() function in the templates, it's safer.
I didn't understand your first question... where whould I try foreach($array[0] as $subArray)
?
To clarify, in my jade template I have something like:
- each item in [1,2,3,4,5,6,7]
I am not able to use the array()
syntax in jade because some of my templates are also compiled in javascript (I know, large legacy project).
Sorry for my english.
I said you should do instead :
- each item in array(1, 2, 3, 4, 5, 6, 7)
Because if you need to do this elsewhere :
- each subItem in items["some-item"]
Youre str_replace will broke it, [ and ] can be array( and ) but offset selection too. So be carefull.
Ok, I understand now :-) Yes, of course, my patch is not a proper fix. I'm not familiar with the code so I wasn't able to implement a correct patch. Sorry.
I got the following error using PHP 5.3.20:
I managed to make it work with this hacky workaround in src/Jade/Compiler.php (replace
[]
syntax witharray()
syntax):