Below I insert a part of the code in which I connect the header.tpl template to index.php
$template = file ('header.tpl'); if(!isset($html)) { $html = "Eror 404"; $page_name=" : Eror 404"; } if(!isset($page_name)) { $page_name=" : Error Name Page"; } foreach ($template as $temp) { $temp = ereg_replace("<!--text-->", "$html", $temp); echo "$temp"; }
On OSPanel everything works, I install it on the server, it does not work. I tried to specify the path $ template = file ('../header.tpl'); still does not work. Tell me how to rewrite the code so that the file is connected to the server?
file ('../header.tpl')
if you indicated this path, I can say that you went up one directory, probablyfile(dirname(__DIR__)."/header.tpl");
would be more correctfile(dirname(__DIR__)."/header.tpl");
if you have header.tpl in the main directory is - Walfterereg_replace
generally removed as a rudiment from pkhp7, which you have on the server? further read about template engines in php, and choose something sensible and modern, and not push regular expressions where they are out of place. - teran