Hello all
I need your help with a code we are rewriting/updating
files are scattered amongst several folders, one folder is the main folder (original). all folders have the same folder structure and most having identical file NAMES as the main folder. Those with identical file names are NOT, usually, the same file; they have been edited by the owner of that folder. Think of it like git master/original and forks/branches.
the code we have accesses files in EITHER the main folder or the 'forks' using a function that returns the directory like this
main_folder().'filepath'; OR
fork_folder().'filepath';
or at times like this
<?php echo main_folder(); ?>filepath
what I need is to change main_folder() to equal fork_folder() but only if 'filepath' exists in that folder, if it doesn't then main_folder() does not change.
So essentially whenever main_folder() is called I need to find what comes after it
; ?> Or ;?> OR .'
get the file that follows, IF ANY, figure out if it exists in fork and change main_folder() or not.
It was suggested to me that the only way to do this is to incorporate js in the code. But there has to be a completely php way do this.
it would have been much easier if main_folder() and fork_folder() were changed to main_folder('filepath') fork_folder('filepath') but that is not an option.
Thanks for any input.