Page 1 of 1
Add Include File
Posted: Mon Jul 19, 2021 1:32 am
by thomas
It will be nice to have a option in the PHPMaker itself to add a include file
As I use to create many project but I have a common function which I have created and want to use on all the project. For this I can include the file from the server script but whenever I change something on the code I have to copy it on all the project again. sometime i forgot for some project.
So if there is a option to include a file just like the Template file option on the Generate Page
Then we can keep the common file in single folder and it can be included on all the project easily.
Re: Add Include File from the PHPMaker Program itself
Posted: Mon Jul 19, 2021 12:18 pm
by arbei
You may include your file by server side Global Code, e.g.
include __DIR__ . "/../myfolder/myfile.php"; // Assume the "myfolder" folder is under the project folder directly
Then your code will be under the project namespace, you do not need to use \
when using your functions or classes.
Re: Add Include File from the PHPMaker Program itself
Posted: Tue Jul 20, 2021 11:42 am
by thomas
This is to insert to a particular project only.
I mean where I can use for every project just like selecting Template while Generating the code.
Re: Add Include File from the PHPMaker Program itself
Posted: Tue Jul 20, 2021 12:22 pm
by arbei
You may create an extension so you can select it for any project easily, see Extensions -> Making Extensions.