Code: Select all
<!-- INCLUDEPHP somefile.php -->
Code: Select all
include($phpbb_root_path . 'filename.' . $phpEx);
Code: Select all
include($phpbb_root_path . 'yourfolder/yourfile.' . $phpEx);
Code: Select all
if (!function_exists('some function in yourfile'))
{
include($phpbb_root_path . 'yourfolder/yourfile.' . $phpEx);
}
That's good practice David but for my own use it would be unnecessary, I only have one file included with functions in common.php which makes them available everywhere. You may be unnecessarily loading functions but it's just easier than editing multiple phpBB files. You can also use require instead of include, if the file is not found it's fatal error and the script will stop execution which makes it easy to identify if the path is wrong.david63 wrote: ↑Sat Jan 15, 2022 8:29 am I would also add that if you are including another file in a .php file then it is good practice to add a check that the file is not already present.
Something likeCode: Select all
if (!function_exists('some function in yourfile')) { include($phpbb_root_path . 'yourfolder/yourfile.' . $phpEx); }
xyz_functions.php
, xyz_someotherfile.php.
, etc. This will avoid naming conflicts, you can apply this to everything whether it's php variables, function names, CSS rules, custom HTML elements, etc. Other than avoiding conflicts it's also helpful to easily find and identify them if you consistently use the same string.