Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Including my own php and/or javascript files

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
icoso
Posts: 181
Joined: Sun Feb 07, 2021 11:09 pm
Been thanked: 1 time

Including my own php and/or javascript files

Unread post 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?
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Including my own php and/or javascript files

Unread post 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';)
icoso
Posts: 181
Joined: Sun Feb 07, 2021 11:09 pm
Been thanked: 1 time

Re: Including my own php and/or javascript files

Unread post 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.
icoso
Posts: 181
Joined: Sun Feb 07, 2021 11:09 pm
Been thanked: 1 time

Re: Including my own php and/or javascript files

Unread post by icoso »

I added <? php to the beginning and ?> to the end and now its working.
apmuthu
Posts: 249
Joined: Sun Dec 06, 2020 6:50 am
Location: Chennai, India, Singapore

Re: Including my own php and/or javascript files

Unread post by apmuthu »

Wiki-ed.
Post Reply