From 4043d9cc6cd2a83217cbc5899e110739cb0913ca Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Fri, 14 Aug 2009 22:31:09 +0000 Subject: [PATCH] menuData added to tablestyle() function - more options for theming. --- class2.php | 10 ++-- e107_files/shortcode/menu.php | 69 ++++++++++++++--------- e107_files/shortcode/setstyle.php | 12 ++++ e107_files/shortcode/setstyle.sc | 2 - e107_themes/e107v4a/theme.php | 92 +++++++++++++++++-------------- 5 files changed, 113 insertions(+), 72 deletions(-) create mode 100644 e107_files/shortcode/setstyle.php delete mode 100644 e107_files/shortcode/setstyle.sc diff --git a/class2.php b/class2.php index 6695a02c5..cc72d61ff 100644 --- a/class2.php +++ b/class2.php @@ -9,8 +9,8 @@ * General purpose file * * $Source: /cvs_backup/e107_0.8/class2.php,v $ -* $Revision: 1.126 $ -* $Date: 2009-08-14 21:11:49 $ +* $Revision: 1.127 $ +* $Date: 2009-08-14 22:31:08 $ * $Author: e107coders $ * */ @@ -885,6 +885,8 @@ if (!class_exists('e107table')) public $eMenuCount = 0; public $eMenuArea; + public $eMenuTotal = 0; + public $eSetStyle; function tablerender($caption, $text, $mode = 'default', $return = false) { @@ -915,7 +917,7 @@ if (!class_exists('e107table')) $this->eMenuCount++; } 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(); ob_end_clean(); @@ -928,7 +930,7 @@ if (!class_exists('e107table')) { $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 ''; } } diff --git a/e107_files/shortcode/menu.php b/e107_files/shortcode/menu.php index f870341cf..7870ec7e9 100644 --- a/e107_files/shortcode/menu.php +++ b/e107_files/shortcode/menu.php @@ -1,5 +1,5 @@ eMenuArea = $tmp[0]; + 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']) { list($listtype, $listpages) = explode('-', $row['menu_pages'], 2); @@ -32,7 +35,8 @@ function menu_shortcode($parm) if($listtype == '1') //show menu { - $show_menu = FALSE; + //$show_menu[$pkey] = FALSE; + unset($show_menu[$pkey]); foreach($pagelist as $p) { if(substr($p, -1) == '!') @@ -40,52 +44,60 @@ function menu_shortcode($parm) $p = substr($p, 0, -1); if(substr($check_url, strlen($p)*-1) == $p) { - $show_menu = TRUE; + // $show_menu[$pkey] = TRUE; + $show_menu[$pkey] = $row['menu_name']; } } else { if(strpos($check_url,$p) !== FALSE) { - $show_menu = TRUE; + // $show_menu[$pkey] = TRUE; + $show_menu[$pkey] = $row['menu_name']; } } } } elseif($listtype == '2') //hide menu { - $show_menu = TRUE; + // $show_menu[$pkey] = TRUE; + $show_menu[$pkey] = $row['menu_name']; foreach($pagelist as $p) { if(substr($p, -1) == '!') { $p = substr($p, 0, -1); if(substr($check_url, strlen($p)*-1) == $p) { - $show_menu = FALSE; + // $show_menu[$pkey] = FALSE; + unset($show_menu[$pkey]); } } else { if(strpos($check_url, $p) !== FALSE) { - $show_menu = FALSE; + // $show_menu[$pkey] = FALSE; + unset($show_menu[$pkey]); } } } } } + } - if($show_menu) - { - $mname = $row['menu_name']; + e107::getRender()->eMenuTotal = count($show_menu); + + foreach($show_menu as $mpath=>$mname) + { + // $mname = $row['menu_name']; if($error_handler->debug == true) { echo "\n\n"; } - $sql->db_Mark_Time($row['menu_name']); - if(is_numeric($row['menu_path'])) + $sql->db_Mark_Time($mname); + if(is_numeric($mpath)) { - $sql -> db_Select("page", "*", "page_id='".$row['menu_path']."' "); + $sql -> db_Select("page", "*", "page_id='".$mpath."' "); $page = $sql -> db_Fetch(); $caption = $e107->tp->toHTML($page['page_title'], TRUE, 'parse_sc, constants'); $text = $e107->tp->toHTML($page['page_text'], TRUE, 'parse_sc, constants'); @@ -93,26 +105,26 @@ function menu_shortcode($parm) } 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.")"); @@ -120,16 +132,21 @@ function menu_shortcode($parm) { echo "\n\n"; } + unset($caption,$text); // clear variables for proceeding menus. } - } + e107::getRender()->eMenuCount = 0; e107::getRender()->eMenuArea = null; + if ($buffer_output) { $ret = ob_get_contents(); ob_end_clean(); return $ret; } -} \ No newline at end of file +} + + +?> \ No newline at end of file diff --git a/e107_files/shortcode/setstyle.php b/e107_files/shortcode/setstyle.php new file mode 100644 index 000000000..91023b3a7 --- /dev/null +++ b/e107_files/shortcode/setstyle.php @@ -0,0 +1,12 @@ +eSetStyle = $parm; + } + +?> diff --git a/e107_files/shortcode/setstyle.sc b/e107_files/shortcode/setstyle.sc deleted file mode 100644 index a4017bab6..000000000 --- a/e107_files/shortcode/setstyle.sc +++ /dev/null @@ -1,2 +0,0 @@ -global $style; -$style = $parm; \ No newline at end of file diff --git a/e107_themes/e107v4a/theme.php b/e107_themes/e107v4a/theme.php index 5214f2fe6..37d6631a8 100644 --- a/e107_themes/e107v4a/theme.php +++ b/e107_themes/e107v4a/theme.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_themes/e107v4a/theme.php,v $ -| $Revision: 1.4 $ -| $Date: 2008-11-17 07:17:23 $ +| $Revision: 1.5 $ +| $Date: 2009-08-14 22:31:09 $ | $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -51,6 +51,7 @@ $HEADER['3_column'] = [ {SITENAME} ] +{SETSTYLE=banner} {BANNER} @@ -63,12 +64,17 @@ $HEADER['3_column'] = +{SETSTYLE=links} {SITELINKS=menu} +{SETSTYLE=leftmenu} {MENU=1} -"; + +{SETSTYLE=content} +"; $FOOTER['3_column'] = " +{SETSTYLE=rightmenu} {MENU=2} @@ -120,6 +126,7 @@ $HEADER['2_column'] = [ {SITENAME} ] +{SETSTYLE=banner} {BANNER} @@ -131,13 +138,17 @@ $HEADER['2_column'] = +{SETSTYLE=links} {SITELINKS=menu} +{SETSTYLE=leftmenu} {MENU=1} "; $FOOTER['2_column'] = -" +" +{SETSTYLE=content} + @@ -240,44 +251,45 @@ define(LINKALIGN, "left"); // [tablestyle] -function tablestyle($caption, $text){ - global $style; +function tablestyle($caption, $text,$id, $dataArray) +{ + // global $style; // Not needed - see $dataArray; - echo " -
- - - - - - -
- - - - - - - - -
".$caption."
- - - - - - -
".$text."
- - - - - - -
-
-"; + echo " +
+ + + + + + +
+ + + + + + + + +
".$caption."
+ + + + + + +
".$text."
+ + + + + + +
+
+ "; }