This topic is locked

php functions from html bricks

12/2/2018 5:42:57 AM
PHPRunner General questions
E
ermolenkoeug author

Hello

is it possible to call php function from html briks file

I've created the function on after application initialized event

function testEcho()

{

echo 'it WORKS!!!';

}


Also I've created a brick mybrick.html

<div style="height: 120px; padding-left:20px; background-image: url(images/menumessbg.png);background-size: 60%;background-repeat: no-repeat;background-position: right 35px;">



</div>



I want to display result of testEcho() function on all pages where mybrick was placed

Does anyone tried to do something like this?
I know about "insert code snippet"

but it's not useful for me

many functions and many pages

H
headingwest 12/3/2018



Hello

is it possible to call php function from html briks file

I've created the function on after application initialized event

function testEcho()

{

echo 'it WORKS!!!';

}


Also I've created a brick mybrick.html

<div style="height: 120px; padding-left:20px; background-image: url(images/menumessbg.png);background-size: 60%;background-repeat: no-repeat;background-position: right 35px;">
</div>



I want to display result of testEcho() function on all pages where mybrick was placed

Does anyone tried to do something like this?
I know about "insert code snippet"

but it's not useful for me

many functions and many pages


Create a separate php file and use include or include_once in after app init
There's also a custom css area, check the help file

admin 12/3/2018

HTML bricks cannot contain PHP code. In version 10 you re-use code snippets so you can only need to write your code once and then insert it anywhere you want.