I am trying to work out how I can get a file to check if another file exists and if so load that file instead of the one that the request is coming from.
So if I had a file
/includes/action.php
but I want it over-ridden if there is a file present at
/template/mytemplate/action.php
If there is then everything in /includes/action is ignored and everything in /template/mytemplate/action.php is used instead.
If there is nothing in the mytemplate folder then the original file is loaded.
I was paying around with file-sxists but could not get it work, I have this code;
I also tried is_file and include but that did not work either.PHP Code:$filename = SITE_ROOT.'/templates/'.TEMPLATE.'/action.php';
if (file_exists($filename)){
require_once($filename);
} else {
....
};
Please help![]()



Reply With Quote


Bookmarks