1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 14:17:49 +02:00

Fixes #3932 Added support for dynamic header/footer templates controlled by theme_shortcodes class.

This commit is contained in:
Cameron
2019-08-22 14:28:59 -07:00
parent 68e4fd7d03
commit 1d45f1e4c4
5 changed files with 25 additions and 4 deletions

View File

@@ -72,6 +72,8 @@ if (varset($e107_popup) != 1)
$psc = array(
'</body>' => '',
'{THEME}' => THEME_ABS,
'{---HEADER---}' => $tp->parseTemplate('{HEADER}',true),
'{---FOOTER---}' => $tp->parseTemplate('{FOOTER}',true)
);
parseheader($FOOTER, $psc);

View File

@@ -804,6 +804,8 @@ if ($e107_popup != 1) {
'{BODY_ONLOAD}' => $body_onload,
'{LAYOUT_ID}' => 'layout-'.e107::getForm()->name2id(THEME_LAYOUT),
'{---MODAL---}' => $LAYOUT['_modal_'],
'{---HEADER---}' => $tp->parseTemplate('{HEADER}',true),
'{---FOOTER---}' => $tp->parseTemplate('{FOOTER}',true),
);
parseheader($HEADER, $psc);

View File

@@ -2186,6 +2186,8 @@ class e_menu_layout
$layout = array();
foreach($head as $k=>$v)
{
$template = $head[$k]."\n{---}".$foot[$k];

View File

@@ -527,14 +527,16 @@ class e_parse_shortcode
*
* @return e_parse_shortcode
*/
public function loadThemeShortcodes()
public function loadThemeShortcodes($theme=null)
{
global $register_sc;
if(file_exists(THEME."theme_shortcodes.php"))
$themePath = ($theme === null) ? THEME : e_THEME.$theme.'/';
if(file_exists($themePath."theme_shortcodes.php"))
{
$classFunc = 'theme_shortcodes';
$path = THEME."theme_shortcodes.php";
$path = $themePath."theme_shortcodes.php";
include_once($path);
$this->registerClassMethods($classFunc, $path, false);
}

View File

@@ -102,6 +102,19 @@ class e_theme
list($LAYOUT['_header_'], $LAYOUT['_footer_']) = explode("{---LAYOUT---}", $tmp, 2);
$tp = e107::getParser();
e107::getScParser()->loadThemeShortcodes($theme);
if(strpos($LAYOUT['_header_'], '{---HEADER---}')!==false)
{
$LAYOUT['_header_'] = str_replace('{---HEADER---}', $tp->parseTemplate('{HEADER}', true), $LAYOUT['_header_']);
}
if(strpos($LAYOUT['_footer_'], '{---FOOTER---}')!==false)
{
$LAYOUT['_footer_'] = str_replace('{---FOOTER---}', $tp->parseTemplate('{FOOTER}', true), $LAYOUT['_footer_']);
}
$LAYOUT[$key] = file_get_contents(e_THEME.$theme."/layouts/".$key."_layout.html");
return $LAYOUT;