1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 03:40:37 +02:00

menuData added to tablestyle() function - more options for theming.

This commit is contained in:
CaMer0n
2009-08-14 22:31:09 +00:00
parent eaf6929c5a
commit 4043d9cc6c
5 changed files with 113 additions and 72 deletions

View File

@@ -9,8 +9,8 @@
* General purpose file * General purpose file
* *
* $Source: /cvs_backup/e107_0.8/class2.php,v $ * $Source: /cvs_backup/e107_0.8/class2.php,v $
* $Revision: 1.126 $ * $Revision: 1.127 $
* $Date: 2009-08-14 21:11:49 $ * $Date: 2009-08-14 22:31:08 $
* $Author: e107coders $ * $Author: e107coders $
* *
*/ */
@@ -885,6 +885,8 @@ if (!class_exists('e107table'))
public $eMenuCount = 0; public $eMenuCount = 0;
public $eMenuArea; public $eMenuArea;
public $eMenuTotal = 0;
public $eSetStyle;
function tablerender($caption, $text, $mode = 'default', $return = false) function tablerender($caption, $text, $mode = 'default', $return = false)
{ {
@@ -915,7 +917,7 @@ if (!class_exists('e107table'))
$this->eMenuCount++; $this->eMenuCount++;
} }
ob_start(); ob_start();
tablestyle($caption, $text, $mode, $this->eMenuCount); tablestyle($caption, $text, $mode, array('menuArea'=>$this->eMenuArea,'menuCount'=>$this->eMenuCount,'menuTotal'=>$this->eMenuTotal,'setStyle'=>$this->eSetStyle));
$ret=ob_get_contents(); $ret=ob_get_contents();
ob_end_clean(); ob_end_clean();
@@ -928,7 +930,7 @@ if (!class_exists('e107table'))
{ {
$this->eMenuCount++; $this->eMenuCount++;
} }
tablestyle($caption, $text, $mode, $this->eMenuCount); tablestyle($caption, $text, $mode, array('menuArea'=>$this->eMenuArea,'menuCount'=>$this->eMenuCount,'menuTotal'=>$this->eMenuTotal,'setStyle'=>$this->eSetStyle));
return ''; return '';
} }
} }

View File

@@ -1,5 +1,5 @@
<?php <?php
/* $Id: menu.php,v 1.3 2009-08-14 15:57:45 e107coders Exp $ */ /* $Id: menu.php,v 1.4 2009-08-14 22:31:09 e107coders Exp $ */
function menu_shortcode($parm) function menu_shortcode($parm)
{ {
@@ -21,9 +21,12 @@ function menu_shortcode($parm)
e107::getRender()->eMenuArea = $tmp[0]; e107::getRender()->eMenuArea = $tmp[0];
foreach($eMenuList[$tmp[0]] as $row) foreach($eMenuList[$tmp[0]] as $row)
{ {
$show_menu = TRUE; $pkey = str_replace("/","",$row['menu_path']);
$show_menu[$pkey] = $row['menu_name'];
if($row['menu_pages']) if($row['menu_pages'])
{ {
list($listtype, $listpages) = explode('-', $row['menu_pages'], 2); list($listtype, $listpages) = explode('-', $row['menu_pages'], 2);
@@ -32,7 +35,8 @@ function menu_shortcode($parm)
if($listtype == '1') //show menu if($listtype == '1') //show menu
{ {
$show_menu = FALSE; //$show_menu[$pkey] = FALSE;
unset($show_menu[$pkey]);
foreach($pagelist as $p) foreach($pagelist as $p)
{ {
if(substr($p, -1) == '!') if(substr($p, -1) == '!')
@@ -40,52 +44,60 @@ function menu_shortcode($parm)
$p = substr($p, 0, -1); $p = substr($p, 0, -1);
if(substr($check_url, strlen($p)*-1) == $p) if(substr($check_url, strlen($p)*-1) == $p)
{ {
$show_menu = TRUE; // $show_menu[$pkey] = TRUE;
$show_menu[$pkey] = $row['menu_name'];
} }
} }
else else
{ {
if(strpos($check_url,$p) !== FALSE) if(strpos($check_url,$p) !== FALSE)
{ {
$show_menu = TRUE; // $show_menu[$pkey] = TRUE;
$show_menu[$pkey] = $row['menu_name'];
} }
} }
} }
} }
elseif($listtype == '2') //hide menu elseif($listtype == '2') //hide menu
{ {
$show_menu = TRUE; // $show_menu[$pkey] = TRUE;
$show_menu[$pkey] = $row['menu_name'];
foreach($pagelist as $p) { foreach($pagelist as $p) {
if(substr($p, -1) == '!') if(substr($p, -1) == '!')
{ {
$p = substr($p, 0, -1); $p = substr($p, 0, -1);
if(substr($check_url, strlen($p)*-1) == $p) if(substr($check_url, strlen($p)*-1) == $p)
{ {
$show_menu = FALSE; // $show_menu[$pkey] = FALSE;
unset($show_menu[$pkey]);
} }
} }
else else
{ {
if(strpos($check_url, $p) !== FALSE) if(strpos($check_url, $p) !== FALSE)
{ {
$show_menu = FALSE; // $show_menu[$pkey] = FALSE;
unset($show_menu[$pkey]);
} }
} }
} }
} }
} }
}
if($show_menu) e107::getRender()->eMenuTotal = count($show_menu);
{
$mname = $row['menu_name']; foreach($show_menu as $mpath=>$mname)
{
// $mname = $row['menu_name'];
if($error_handler->debug == true) if($error_handler->debug == true)
{ {
echo "\n<!-- Menu Start: ".$mname." -->\n"; echo "\n<!-- Menu Start: ".$mname." -->\n";
} }
$sql->db_Mark_Time($row['menu_name']); $sql->db_Mark_Time($mname);
if(is_numeric($row['menu_path'])) if(is_numeric($mpath))
{ {
$sql -> db_Select("page", "*", "page_id='".$row['menu_path']."' "); $sql -> db_Select("page", "*", "page_id='".$mpath."' ");
$page = $sql -> db_Fetch(); $page = $sql -> db_Fetch();
$caption = $e107->tp->toHTML($page['page_title'], TRUE, 'parse_sc, constants'); $caption = $e107->tp->toHTML($page['page_title'], TRUE, 'parse_sc, constants');
$text = $e107->tp->toHTML($page['page_text'], TRUE, 'parse_sc, constants'); $text = $e107->tp->toHTML($page['page_text'], TRUE, 'parse_sc, constants');
@@ -93,26 +105,26 @@ function menu_shortcode($parm)
} }
else else
{ {
if (is_readable(e_PLUGIN.$row['menu_path']."/languages/".e_LANGUAGE.".php")) if (is_readable(e_PLUGIN.$mpath."/languages/".e_LANGUAGE.".php"))
{ {
include_once(e_PLUGIN.$row['menu_path']."/languages/".e_LANGUAGE.".php"); include_once(e_PLUGIN.$mpath."/languages/".e_LANGUAGE.".php");
} }
elseif (is_readable(e_PLUGIN.$row['menu_path']."/languages/".e_LANGUAGE."/".e_LANGUAGE.".php")) elseif (is_readable(e_PLUGIN.$mpath."/languages/".e_LANGUAGE."/".e_LANGUAGE.".php"))
{ {
include_once(e_PLUGIN.$row['menu_path']."/languages/".e_LANGUAGE."/".e_LANGUAGE.".php"); include_once(e_PLUGIN.$mpath."/languages/".e_LANGUAGE."/".e_LANGUAGE.".php");
} }
elseif (is_readable(e_PLUGIN.$row['menu_path']."/languages/English.php")) elseif (is_readable(e_PLUGIN.$mpath."/languages/English.php"))
{ {
include_once(e_PLUGIN.$row['menu_path']."/languages/English.php"); include_once(e_PLUGIN.$mpath."/languages/English.php");
} }
elseif (is_readable(e_PLUGIN.$row['menu_path']."/languages/English/English.php")) elseif (is_readable(e_PLUGIN.$mpath."/languages/English/English.php"))
{ {
include_once(e_PLUGIN.$row['menu_path']."/languages/English/English.php"); include_once(e_PLUGIN.$mpath."/languages/English/English.php");
} }
if(file_exists(e_PLUGIN.$row['menu_path']."/".$mname.".php")) if(file_exists(e_PLUGIN.$mpath."/".$mname.".php"))
{ {
include_once(e_PLUGIN.$row['menu_path']."/".$mname.".php"); include_once(e_PLUGIN.$mpath."/".$mname.".php");
} }
} }
$sql->db_Mark_Time("(After ".$mname.")"); $sql->db_Mark_Time("(After ".$mname.")");
@@ -120,16 +132,21 @@ function menu_shortcode($parm)
{ {
echo "\n<!-- Menu End: ".$mname." -->\n"; echo "\n<!-- Menu End: ".$mname." -->\n";
} }
unset($caption,$text); // clear variables for proceeding menus.
} }
}
e107::getRender()->eMenuCount = 0; e107::getRender()->eMenuCount = 0;
e107::getRender()->eMenuArea = null; e107::getRender()->eMenuArea = null;
if ($buffer_output) if ($buffer_output)
{ {
$ret = ob_get_contents(); $ret = ob_get_contents();
ob_end_clean(); ob_end_clean();
return $ret; return $ret;
} }
} }
?>

View File

@@ -0,0 +1,12 @@
<?php
/* $Id: setstyle.php,v 1.1 2009-08-14 22:31:09 e107coders Exp $ */
function setstyle_shortcode($parm)
{
global $style; // BC
$style = $parm; // BC
e107::getRender()->eSetStyle = $parm;
}
?>

View File

@@ -1,2 +0,0 @@
global $style;
$style = $parm;

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_themes/e107v4a/theme.php,v $ | $Source: /cvs_backup/e107_0.8/e107_themes/e107v4a/theme.php,v $
| $Revision: 1.4 $ | $Revision: 1.5 $
| $Date: 2008-11-17 07:17:23 $ | $Date: 2009-08-14 22:31:09 $
| $Author: e107coders $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -51,6 +51,7 @@ $HEADER['3_column'] =
<img src='".THEME_ABS."images/logo.png' alt='' /> [ {SITENAME} ] <img src='".THEME_ABS."images/logo.png' alt='' /> [ {SITENAME} ]
</td> </td>
<td style='text-align:right'> <td style='text-align:right'>
{SETSTYLE=banner}
{BANNER} {BANNER}
</td> </td>
</tr> </tr>
@@ -63,12 +64,17 @@ $HEADER['3_column'] =
</tr> </tr>
<tr> <tr>
<td style='width:20%; vertical-align: top;'> <td style='width:20%; vertical-align: top;'>
{SETSTYLE=links}
{SITELINKS=menu} {SITELINKS=menu}
{SETSTYLE=leftmenu}
{MENU=1} {MENU=1}
</td><td style='width:60%; vertical-align: top;'>"; </td><td style='width:60%; vertical-align: top;'>
{SETSTYLE=content}
";
$FOOTER['3_column'] = $FOOTER['3_column'] =
"</td><td style='width:20%; vertical-align:top'> "</td><td style='width:20%; vertical-align:top'>
{SETSTYLE=rightmenu}
{MENU=2} {MENU=2}
</td></tr> </td></tr>
<tr> <tr>
@@ -120,6 +126,7 @@ $HEADER['2_column'] =
<img src='".THEME_ABS."images/logo.png' alt='' /> [ {SITENAME} ] <img src='".THEME_ABS."images/logo.png' alt='' /> [ {SITENAME} ]
</td> </td>
<td style='text-align:right'> <td style='text-align:right'>
{SETSTYLE=banner}
{BANNER} {BANNER}
</td> </td>
</tr> </tr>
@@ -131,13 +138,17 @@ $HEADER['2_column'] =
</tr> </tr>
<tr> <tr>
<td style='width:20%; vertical-align: top;'> <td style='width:20%; vertical-align: top;'>
{SETSTYLE=links}
{SITELINKS=menu} {SITELINKS=menu}
{SETSTYLE=leftmenu}
{MENU=1} {MENU=1}
</td><td style='width:60%; vertical-align: top;'>"; </td><td style='width:60%; vertical-align: top;'>";
$FOOTER['2_column'] = $FOOTER['2_column'] =
"</td></tr> "
{SETSTYLE=content}
</td></tr>
<tr> <tr>
<td colspan='2' style='text-align:center' class='smalltext'> <td colspan='2' style='text-align:center' class='smalltext'>
@@ -240,44 +251,45 @@ define(LINKALIGN, "left");
// [tablestyle] // [tablestyle]
function tablestyle($caption, $text){ function tablestyle($caption, $text,$id, $dataArray)
global $style; {
// global $style; // Not needed - see $dataArray;
echo " echo "
<div class='spacer'> <div class='spacer'>
<table cellpadding='0' cellspacing='0'> <table cellpadding='0' cellspacing='0'>
<tr> <tr>
<td class='captiontopleft'><img src='".THEME_ABS."images/blank.gif' width='24' height='3' alt='' style='display: block;' /></td> <td class='captiontopleft'><img src='".THEME_ABS."images/blank.gif' width='24' height='3' alt='' style='display: block;' /></td>
<td class='captiontopmiddle'><img src='".THEME_ABS."images/blank.gif' width='1' height='3' alt='' style='display: block;' /></td> <td class='captiontopmiddle'><img src='".THEME_ABS."images/blank.gif' width='1' height='3' alt='' style='display: block;' /></td>
<td class='captiontopright'><img src='".THEME_ABS."images/blank.gif' width='11' height='3' alt='' style='display: block;' /></td> <td class='captiontopright'><img src='".THEME_ABS."images/blank.gif' width='11' height='3' alt='' style='display: block;' /></td>
</tr> </tr>
</table> </table>
<table cellpadding='0' cellspacing='0'> <table cellpadding='0' cellspacing='0'>
<tr> <tr>
<td class='captionleft'><img src='".THEME_ABS."images/blank.gif' width='24' height='18' alt='' style='display: block;' /></td> <td class='captionleft'><img src='".THEME_ABS."images/blank.gif' width='24' height='18' alt='' style='display: block;' /></td>
<td class='captionbar' style='white-space:nowrap'>".$caption."</td> <td class='captionbar' style='white-space:nowrap'>".$caption."</td>
<td class='captionend'><img src='".THEME_ABS."images/blank.gif' width='12' height='18' alt='' style='display: block;' /></td> <td class='captionend'><img src='".THEME_ABS."images/blank.gif' width='12' height='18' alt='' style='display: block;' /></td>
<td class='captionmain'><img src='".THEME_ABS."images/blank.gif' width='1' height='18' alt='' style='display: block;' /></td> <td class='captionmain'><img src='".THEME_ABS."images/blank.gif' width='1' height='18' alt='' style='display: block;' /></td>
<td class='captionright'><img src='".THEME_ABS."images/blank.gif' width='11' height='18' alt='' style='display: block;' /></td> <td class='captionright'><img src='".THEME_ABS."images/blank.gif' width='11' height='18' alt='' style='display: block;' /></td>
</tr> </tr>
</table> </table>
<table cellpadding='0' cellspacing='0'> <table cellpadding='0' cellspacing='0'>
<tr> <tr>
<td class='bodyleft'><img src='".THEME_ABS."images/blank.gif' width='3' height='1' alt='' style='display: block;' /></td> <td class='bodyleft'><img src='".THEME_ABS."images/blank.gif' width='3' height='1' alt='' style='display: block;' /></td>
<td class='bodymain'>".$text."</td> <td class='bodymain'>".$text."</td>
<td class='bodyright'><img src='".THEME_ABS."images/blank.gif' width='3' height='1' alt='' style='display: block;' /></td> <td class='bodyright'><img src='".THEME_ABS."images/blank.gif' width='3' height='1' alt='' style='display: block;' /></td>
</tr> </tr>
</table> </table>
<table cellpadding='0' cellspacing='0'> <table cellpadding='0' cellspacing='0'>
<tr> <tr>
<td class='bottomleft'><img src='".THEME_ABS."images/blank.gif' width='10' height='9' alt='' style='display: block;' /></td> <td class='bottomleft'><img src='".THEME_ABS."images/blank.gif' width='10' height='9' alt='' style='display: block;' /></td>
<td class='bottommain'><img src='".THEME_ABS."images/blank.gif' width='1' height='9' alt='' style='display: block;' /></td> <td class='bottommain'><img src='".THEME_ABS."images/blank.gif' width='1' height='9' alt='' style='display: block;' /></td>
<td class='bottomright'><img src='".THEME_ABS."images/blank.gif' width='10' height='9' alt='' style='display: block;' /></td> <td class='bottomright'><img src='".THEME_ABS."images/blank.gif' width='10' height='9' alt='' style='display: block;' /></td>
</tr> </tr>
</table> </table>
</div> </div>
"; ";
} }