New Zenner
- Join Date:
- Jun 2010
- Posts:
- 2
- Plugin Contributions:
- 0
[Not a bug] Can't override pages/specials/main_template_vars.php
I'm using 1.3.9a, and I wasn't able to make a theme-specific override to includes/modules/pages/specials/main_template_vars.php.
The flaw appears to be in includes/templates/template_default/common/main_template_vars.php - when it does its check for the "special" page's source file, it looks for:
DIR_WS_MODULES . 'pages/' . $current_page_base . '/main_template_vars.php'
Now DIR_WS_MODULES is 'includes/modules', and $current_page_base is 'specials'. There's no check for a per-theme override.
I worked around it by overriding includes/templates/template_default/common/main_template_vars.php and making it look like this:
<?php
if (file_exists(DIR_WS_MODULES . 'mytheme/pages/' . $current_page_base . '/main_template_vars.php')) {
$body_code = DIR_WS_MODULES . 'mytheme/pages/' . $current_page_base . '/main_template_vars.php';
} else if (file_exists(DIR_WS_MODULES . 'pages/' . $current_page_base . '/main_template_vars.php')) {
$body_code = DIR_WS_MODULES . 'pages/' . $current_page_base . '/main_template_vars.php';
} else {
$body_code = $template->get_template_dir('tpl_' . preg_replace('/.php/', '',$_GET['main_page']) . '_default.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_' . $_GET['main_page'] . '_default.php';
}
?>
I think it could be done in the default file in a more generic way, though. Probably by using "$template_dir" instead of the theme name?