[Pmwiki-users] Check if file exists and is readable in tlayout.php

Thomas -Balu- Walter list+pmwiki-users
Thu Feb 26 12:43:39 CST 2004


Problem (besides being stupid and setting the wrong value):
Warning: file("pub/skin/balu/default.html") - No such file or directory
in /xxx/public_html/pmwiki/scripts/tlayout.php on line 51

Solution:
if (!@is_file(FmtPageName($PageTemplateFmt,$pagename)) || 
    !is_readable(FmtPageName($PageTemplateFmt,$pagename))) {
  print('Sorry, can not read the template file <i>'
    .FmtPageName($PageTemplateFmt,$pagename.'</i>.'));
  exit;
}
$k = str_replace('$HTMLHeaders','<!--HeaderText-->',           # deprecated
  implode('',file(FmtPageName($PageTemplateFmt,$pagename))));

     Balu



More information about the pmwiki-users mailing list