I am trying to run one of the two files on my site using if file exist and readfile functions.
When I give the file path in readfile() it runs properly.
But when I use same file path into if file exist() it says "file does not exist".
=================
It returns error "file does not exist"
<?php
$filename = '{SITE_URL}templates/{TPL_NAME}/sidebars/{NODE_ID}.html';
if (file_exists($filename)) {
echo "The file $filename exists";
} else {
echo "The file $filename does not exist";
}
?>
=====================
It runs properly .....
<?php
readfile("{SITE_URL}templates/{TPL_NAME}/sidebars/{NODE_ID}.html");
?>
=========================
It does not work at all .....
<?php
IF(file_exists("{SITE_URL}templates/{TPL_NAME}/sidebars/{NODE_ID}" . ".html"))
{
readfile("{SITE_URL}templates/{TPL_NAME}/sidebars/{NODE_ID}.html");
}
?>
====================
Though this file path contains memory variables still works fine in readfile(). Actual file path is http://eshop11.com/templates/version4/sidebars/268.html
I have just viewed some where that "if file exist" function works only in current directory while readfile() can work from any where.
Any suggestions/guidance please.