public function read($p_filePath)
{
if (!file_exists($p_filePath)) {
return false;
}
if (strtolower(substr($p_filePath, -4)) != '.tpl' && strtolower(substr($p_filePath, -4)) != '.htm' && strtolower(substr($p_filePath, -5)) != '.html') {
return false;
}
// sets the template full path directory and template file name
$this->m_templatePathDirectory = dirname($p_filePath);
$this->m_templateFileName = basename($p_filePath);
// sets the relative template directory, if any
$tplDirPos = strpos($this->m_templatePathDirectory, 'templates/');
$tplDirLength = strlen('templates/');
if ($tplDirPos && ($tplDir = substr($this->m_templatePathDirectory, $tplDirPos + $tplDirLength))) {
$this->m_templateDirectory = $tplDir;
} else {
$this->m_templateDirectory = null;
}
// reads the template file content
if (!($this->m_templateOriginalContent = @file_get_contents($p_filePath))) {
return false;
}
return true;
}