Question Authors' Forum

Answer with php code : can I bypass the mandatory php tags?

 
Picture of Richard Lobb
Re: Answer with php code : can I bypass the mandatory php tags?
by Richard Lobb - Thursday, 5 July 2018, 10:18 PM
 

Good to know the problem is solved.

Yes, those syntax errors are confusing, I admit. They are generated by the Ace code editor which is managing the template - the embedded Twig code isn't valid PHP. You can turn off Ace if you wish by customising the question or its prototype. There's a checkbox "Template uses Ace" at the bottom of the Customisation panel.

Screen dump showing Template Uses Ace checkbox

I prefer to have it on by default, myself, because syntax colouring makes it much easier to edit large templates. Also, nearly all my templates are in Python nowadays, regardless of what language the question is asking for, and the double braces are generally valid Python.

For small PHP templates, though, the Ace editor might be more of a hindrance than a help.

Richard