mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 04:10:38 +02:00
Experimental - Support for theme html templates and layouts.
This commit is contained in:
@@ -641,70 +641,6 @@ if($_SERVER['E_DEV_MENU'] == 'true')
|
|||||||
|
|
||||||
return e_menu_layout::menuSelector();
|
return e_menu_layout::menuSelector();
|
||||||
|
|
||||||
/*
|
|
||||||
$text = '
|
|
||||||
<ul class="nav nav-tabs">
|
|
||||||
<li class="active"><a href="#plugins" data-toggle="tab">'.ADLAN_CL_7.'</a></li>
|
|
||||||
<li><a href="#custom" data-toggle="tab">'.LAN_CUSTOM.'</a></li>
|
|
||||||
</ul>
|
|
||||||
<div class="tab-content">';
|
|
||||||
|
|
||||||
$text .= "
|
|
||||||
<div class='active tab-pane' id='plugins'>
|
|
||||||
<div id='menu-manager-item-list' class='menu-manager-items' style='height:400px;overflow-y:scroll'>";
|
|
||||||
|
|
||||||
$c = 500; // start high to prevent overwriting of keys after we drag and drop.
|
|
||||||
|
|
||||||
foreach($p as $menu => $folder)
|
|
||||||
{
|
|
||||||
$text .= "<div id='{$menu}' class='item draggable regularMenu' style='cursor:move'>";
|
|
||||||
// $text .= str_replace("_menu","",$menu);
|
|
||||||
|
|
||||||
$defaults = array(
|
|
||||||
'name' => $menu,
|
|
||||||
'path' => $folder,
|
|
||||||
'class' => '0'
|
|
||||||
);
|
|
||||||
|
|
||||||
$text .= e_layout::renderMenuOptions($defaults,'layout','area',$c);
|
|
||||||
|
|
||||||
$text .= "</div>";
|
|
||||||
$c++;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$text .= "</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class='tab-pane' id='custom'>";
|
|
||||||
|
|
||||||
if($sql->select('page','*',"menu_name !='' ORDER BY menu_name"))
|
|
||||||
{
|
|
||||||
$text .= "<div id='menu-manager-item-list' class='menu-manager-items' style='height:400px;overflow-y:scroll'>";
|
|
||||||
while($row = $sql->fetch())
|
|
||||||
{
|
|
||||||
$text .= "<div id='".$row['page_id']."' class='item draggable regularMenu' style='cursor:move'>";
|
|
||||||
// $text .= $row['menu_name'];
|
|
||||||
|
|
||||||
$defaults = array(
|
|
||||||
'name' => $row['menu_name'],
|
|
||||||
'path' => $row['page_id'],
|
|
||||||
'class' => '0'
|
|
||||||
);
|
|
||||||
|
|
||||||
$text .= e_layout::renderMenuOptions($defaults,'layout','area',$c);
|
|
||||||
|
|
||||||
$text .= "</div>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$text .= "</div>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$text .= "</div>
|
|
||||||
|
|
||||||
</div>";
|
|
||||||
|
|
||||||
return array('caption'=>MENLAN_57,'text'=>$text);*/
|
|
||||||
}
|
}
|
||||||
//}
|
//}
|
||||||
|
|
||||||
@@ -779,6 +715,8 @@ class e_layout
|
|||||||
{
|
{
|
||||||
|
|
||||||
global $HEADER,$FOOTER,$CUSTOMHEADER,$CUSTOMFOOTER,$style;
|
global $HEADER,$FOOTER,$CUSTOMHEADER,$CUSTOMFOOTER,$style;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->HEADER = $HEADER;
|
$this->HEADER = $HEADER;
|
||||||
$this->FOOTER = $FOOTER;
|
$this->FOOTER = $FOOTER;
|
||||||
@@ -1509,6 +1447,7 @@ if($_POST)
|
|||||||
//BC - configure and dot delimiter deprecated
|
//BC - configure and dot delimiter deprecated
|
||||||
if (!isset($_GET['configure']))
|
if (!isset($_GET['configure']))
|
||||||
{
|
{
|
||||||
|
|
||||||
// $men->menuScanMenus(); // - Runs 2x - Is already called by menuModify() in menumanager_class.php
|
// $men->menuScanMenus(); // - Runs 2x - Is already called by menuModify() in menumanager_class.php
|
||||||
$text = $men->menuRenderMessage();
|
$text = $men->menuRenderMessage();
|
||||||
// $text .= $men->menuSelectLayout();
|
// $text .= $men->menuSelectLayout();
|
||||||
|
@@ -227,7 +227,7 @@ if (is_array($pref['e_meta_list']))
|
|||||||
|
|
||||||
if(is_readable($fname))
|
if(is_readable($fname))
|
||||||
{
|
{
|
||||||
$ret = ($e107_debug || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname);
|
$ret = (!empty($e107_debug) || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// content will be added later
|
// content will be added later
|
||||||
@@ -621,7 +621,18 @@ echo "</head>\n";
|
|||||||
|
|
||||||
// ---------- New in 2.0 -------------------------------------------------------
|
// ---------- New in 2.0 -------------------------------------------------------
|
||||||
|
|
||||||
if(isset($LAYOUT) && is_array($LAYOUT)) // $LAYOUT is a combined $HEADER,$FOOTER.
|
|
||||||
|
$def = THEME_LAYOUT; // The active layout based on custompage matches.
|
||||||
|
|
||||||
|
// v2.2.2 --- Experimental --
|
||||||
|
if($tmp = e_theme::loadLayout(THEME_LAYOUT))
|
||||||
|
{
|
||||||
|
$LAYOUT = $tmp;
|
||||||
|
unset($tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(isset($LAYOUT) && is_array($LAYOUT)) // $LAYOUT is a combined $HEADER,$FOOTER.
|
||||||
{
|
{
|
||||||
foreach($LAYOUT as $key=>$template)
|
foreach($LAYOUT as $key=>$template)
|
||||||
{
|
{
|
||||||
@@ -645,7 +656,6 @@ echo "</head>\n";
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$def = THEME_LAYOUT; // The active layout based on custompage matches.
|
|
||||||
|
|
||||||
// echo "DEF = ".$def."<br />";
|
// echo "DEF = ".$def."<br />";
|
||||||
|
|
||||||
|
@@ -232,7 +232,13 @@ class e_menuManager {
|
|||||||
function menuGrabLayout()
|
function menuGrabLayout()
|
||||||
{
|
{
|
||||||
global $HEADER,$FOOTER,$CUSTOMHEADER,$CUSTOMFOOTER,$LAYOUT;
|
global $HEADER,$FOOTER,$CUSTOMHEADER,$CUSTOMFOOTER,$LAYOUT;
|
||||||
|
|
||||||
|
// new v2.2.2 experimental
|
||||||
|
if($tmp = e_theme::loadLayout($this->curLayout))
|
||||||
|
{
|
||||||
|
$LAYOUT = $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($LAYOUT) && is_array($LAYOUT)) // $LAYOUT is a combined $HEADER,$FOOTER.
|
if(isset($LAYOUT) && is_array($LAYOUT)) // $LAYOUT is a combined $HEADER,$FOOTER.
|
||||||
{
|
{
|
||||||
foreach($LAYOUT as $key=>$template)
|
foreach($LAYOUT as $key=>$template)
|
||||||
@@ -255,8 +261,8 @@ class e_menuManager {
|
|||||||
elseif($this->curLayout && $this->curLayout != "legacyCustom" && (isset($CUSTOMHEADER[$this->curLayout]) || isset($CUSTOMFOOTER[$this->curLayout]))) // 0.7 themes
|
elseif($this->curLayout && $this->curLayout != "legacyCustom" && (isset($CUSTOMHEADER[$this->curLayout]) || isset($CUSTOMFOOTER[$this->curLayout]))) // 0.7 themes
|
||||||
{
|
{
|
||||||
// echo " MODE 0.7 ".$this->curLayout;
|
// echo " MODE 0.7 ".$this->curLayout;
|
||||||
$HEADER = ($CUSTOMHEADER[$this->curLayout]) ? $CUSTOMHEADER[$this->curLayout] : $HEADER;
|
$HEADER = isset($CUSTOMHEADER[$this->curLayout]) ? $CUSTOMHEADER[$this->curLayout] : $HEADER;
|
||||||
$FOOTER = ($CUSTOMFOOTER[$this->curLayout]) ? $CUSTOMFOOTER[$this->curLayout] : $FOOTER;
|
$FOOTER = isset($CUSTOMFOOTER[$this->curLayout]) ? $CUSTOMFOOTER[$this->curLayout] : $FOOTER;
|
||||||
}
|
}
|
||||||
elseif($this->curLayout && is_array($HEADER) && isset($HEADER[$this->curLayout]) && isset($FOOTER[$this->curLayout])) // 0.8 themes - we use only $HEADER and $FOOTER arrays.
|
elseif($this->curLayout && is_array($HEADER) && isset($HEADER[$this->curLayout]) && isset($FOOTER[$this->curLayout])) // 0.8 themes - we use only $HEADER and $FOOTER arrays.
|
||||||
{
|
{
|
||||||
@@ -1212,7 +1218,6 @@ class e_menuManager {
|
|||||||
$pref = e107::getPref();
|
$pref = e107::getPref();
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// echo "<div id='portal'>";
|
// echo "<div id='portal'>";
|
||||||
@@ -2024,6 +2029,12 @@ class e_menu_layout
|
|||||||
$head = array();
|
$head = array();
|
||||||
$foot = array();
|
$foot = array();
|
||||||
|
|
||||||
|
if(!isset($LAYOUT))
|
||||||
|
{
|
||||||
|
$LAYOUT = e_theme::loadLayout(THEME_LAYOUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(isset($LAYOUT) && (isset($HEADER) || isset($FOOTER)))
|
if(isset($LAYOUT) && (isset($HEADER) || isset($FOOTER)))
|
||||||
{
|
{
|
||||||
$fallbackLan = "This theme is using deprecated elements. All [x]HEADER and [x]FOOTER variables should be removed from theme.php."; // DO NOT TRANSLATE!
|
$fallbackLan = "This theme is using deprecated elements. All [x]HEADER and [x]FOOTER variables should be removed from theme.php."; // DO NOT TRANSLATE!
|
||||||
|
@@ -57,7 +57,6 @@ class e_theme
|
|||||||
|
|
||||||
function __construct($options=array())
|
function __construct($options=array())
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!empty($options['themedir']))
|
if(!empty($options['themedir']))
|
||||||
{
|
{
|
||||||
$this->_current = $options['themedir'];
|
$this->_current = $options['themedir'];
|
||||||
@@ -78,6 +77,33 @@ class e_theme
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load theme layout from html files
|
||||||
|
* Required theme.html file in the theme root directory.
|
||||||
|
* @param string $key layout name
|
||||||
|
* @return array|bool
|
||||||
|
*/
|
||||||
|
public static function loadLayout($key)
|
||||||
|
{
|
||||||
|
$theme = e107::pref('core','sitetheme');
|
||||||
|
|
||||||
|
if(!is_readable(e_THEME.$theme."/layouts/".$key."_layout.html") || !is_readable(e_THEME.$theme."/theme.html"))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
e107::getDebug()->log("Using HTML layout: ".$key.".html");
|
||||||
|
|
||||||
|
$tmp = file_get_contents(e_THEME.$theme."/theme.html");
|
||||||
|
$LAYOUT = array();
|
||||||
|
|
||||||
|
list($LAYOUT['_header_'], $LAYOUT['_footer_']) = explode("{---LAYOUT---}", $tmp, 2);
|
||||||
|
|
||||||
|
$LAYOUT[$key] = file_get_contents(e_THEME.$theme."/layouts/".$key."_layout.html");
|
||||||
|
|
||||||
|
return $LAYOUT;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load library dependencies.
|
* Load library dependencies.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user