Page 1 of 1
Including my own php and/or javascript files
Posted: Tue Mar 02, 2021 12:05 am
by icoso
Can use/include my own php file using the include ('myphpfile.php'); statement in the AS BS BE BB or any of the stored PHP procedures? I tried it and it displays it on the screen in a modal/debug window so I wondering if there is some reason that it can't.
Can I do the same thing with any JavaScript files in the Custom Code section? such as: <script type="text/javascript" src="myjavascript.js">
Or rather how can I do this in these sections?
Re: Including my own php and/or javascript files
Posted: Tue Mar 02, 2021 1:40 am
by kev1n
If myphpfile.php is in nuBuilder's root directory, include it like this:
Code: Select all
include_once(__DIR__ . "/../myphpfile.php");
Or include php files in nuconfig.php: ($nuConfigIncludePHP = '..\myphpfile.php';)
Re: Including my own php and/or javascript files
Posted: Tue Mar 02, 2021 3:11 am
by icoso
I tried taking my function and putting that in a php file. I am not putting the <php ? and ?> tags in it. Then saving it in the root of the nubuilder. Then in my After Save code Im putting: include_once(__DIR__ . "/../myphpfile.php");
It reads it, but it displays it on the screen in what looks like a modal screen, along with what looks like the $nudata array. Its what happens if I do an echo in any of the PHP in any of the SA BB BE BS code blocks. It's reading it like text, rather then processing or evaluating it like PHP.
Re: Including my own php and/or javascript files
Posted: Tue Mar 02, 2021 3:42 am
by icoso
I added <? php to the beginning and ?> to the end and now its working.
Re: Including my own php and/or javascript files
Posted: Fri Mar 05, 2021 6:24 pm
by apmuthu