Hi,

I'm fairly new to Backdrop so apologies for a basic question.

I have tried added some simple php to the body of a page using the edit tab and the source option, and using the full html editor.

When I save the page my <?php tag is comment out i.e. replaced with <!--?php.

What am I doing wrong?

Thanks.

Accepted answer

You're missing the 'PHP filter' module which makes this possible. However this was removed from Backdrop core and I don't believe a replacement exists in contrib. This was for security reasons, so I think the recommended way to add custom PHP code is either via a module or theme function...

Comments

Hi Richard,

welcome to Backdrop... so did you enter PHP code into the Text field? Or did you edit a template file?

 

 

Hi and thanks.

When logged into my website as admin I get two tabs, View and Edit. I selected Edit and entered the code into the Body (Edit Summary) part of the page. (Is this called a block?)

BWPanda's picture

You're missing the 'PHP filter' module which makes this possible. However this was removed from Backdrop core and I don't believe a replacement exists in contrib. This was for security reasons, so I think the recommended way to add custom PHP code is either via a module or theme function...