Line 90 | Line 90 |
---|
* Set custom template location (able to use directory outside of phpBB) * @access public */
|
* Set custom template location (able to use directory outside of phpBB) * @access public */
|
function set_custom_template($template_path, $template_name, $template_mode = 'template')
| function set_custom_template($template_path, $template_name, $fallback_template_path = false)
|
{ global $phpbb_root_path, $user;
| { global $phpbb_root_path, $user;
|
Line 103 | Line 103 |
---|
$this->root = $template_path; $this->cachepath = $phpbb_root_path . 'cache/ctpl_' . str_replace('_', '-', $template_name) . '_';
|
$this->root = $template_path; $this->cachepath = $phpbb_root_path . 'cache/ctpl_' . str_replace('_', '-', $template_name) . '_';
|
// As the template-engine is used for more than the template (emails, etc.), we should not set $user->theme in all cases, but only on the real template. if ($template_mode == 'template')
| if ($fallback_template_path !== false)
|
{
|
{
|
$user->theme['template_storedb'] = false; $user->theme['template_inherits_id'] = false;
| if (substr($fallback_template_path, -1) == '/') { $fallback_template_path = substr($fallback_template_path, 0, -1);
|
}
|
}
|
| $this->inherit_root = $fallback_template_path; $this->orig_tpl_inherits_id = true; } else { $this->orig_tpl_inherits_id = false; }
// the database does not store the path or name of a custom template // so there is no way we can properly store custom templates there $this->orig_tpl_storedb = false;
|
$this->_rootref = &$this->_tpldata['.'][0];
| $this->_rootref = &$this->_tpldata['.'][0];
|
Line 193 | Line 205 |
---|
{ global $user, $phpbb_hook;
|
{ global $user, $phpbb_hook;
|
if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $include_once))
| if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $include_once, $this))
|
{ if ($phpbb_hook->hook_return(array(__CLASS__, __FUNCTION__))) {
| { if ($phpbb_hook->hook_return(array(__CLASS__, __FUNCTION__))) {
|
Line 253 | Line 265 |
---|
{ trigger_error("template->_tpl_load(): No file specified for handle $handle", E_USER_ERROR); }
|
{ trigger_error("template->_tpl_load(): No file specified for handle $handle", E_USER_ERROR); }
|
| // reload these settings to have the values they had when this object was initialised // using set_template or set_custom_template, they might otherwise have been overwritten // by other template class instances in between. $user->theme['template_storedb'] = $this->orig_tpl_storedb; $user->theme['template_inherits_id'] = $this->orig_tpl_inherits_id;
|
$filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . '.' . $phpEx; $this->files_template[$handle] = (isset($user->theme['template_id'])) ? $user->theme['template_id'] : 0;
$recompile = false;
|
$filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . '.' . $phpEx; $this->files_template[$handle] = (isset($user->theme['template_id'])) ? $user->theme['template_id'] : 0;
$recompile = false;
|
if (!file_exists($filename) || @filesize($filename) === 0)
| if (!file_exists($filename) || @filesize($filename) === 0 || defined('DEBUG_EXTRA'))
|
{ $recompile = true; }
| { $recompile = true; }
|