Concatenating a variable + string in Jade file
stevenmunro opened this issue · comments
a(href=$companySupportURL + '/policies')
Fatal error: Uncaught Tale\Jade\Parser\Exception: Failed to parse Jade: Attributes in elements and mixins always need a name, it seems you only passed a value.
I'm very unsure how to get around this. It appears that the above works in a node.js environment (without the dollar sign)
To avoid any magic translation unexpected behavior, prefer writing expressions in PHP in tale-jade:
a(href=$companySupportURL . '/policies')
In this case, concatenation operator in PHP is the dot .
.
Exactly what @kylekatarnls wrote (Thank you)
Tale Jade/Pug is a complete re-write of the Jade/Pug engine specifically cut to PHP's needs.
Every expression in Tale Pug is valid PHP code, not JS code.
In PHP, the concatenation operator is the Dot (.
), not a plus (+
)
If you have any further questions, feel free to re-open this :)