// [setup for randomness] $menu_design = 0; // [tablestyle] function tablestyle($caption, $text, $mode){ global $style; global $menu_design; if($style == "sidemenu"){ do { $tmp_design = rand(1, 4); } while ( $tmp_design == $menu_design ); $menu_design = $tmp_design; if( $menu_design == 1 ) { $graphic_width = 210; } elseif( $menu_design == 2 ) { $graphic_width = 210; } elseif( $menu_design == 3 ) { $graphic_width = 210; } elseif( $menu_design == 4 ) { $graphic_width = 210; } echo " <div class='spacer'> <div class='menuTitle_${menu_design}_bg'> <div class='menuTitle_${menu_design}_text'>{$caption}</div> </div> <div class='menuBody'>{$text}</div> <div class='menuBottom_${menu_design}_bg'><img src='".THEME_ABS."images/blank.gif' width='210' height='20' alt='' style='display: block;' /></div> </div> "; }else if($style == "centermenu"){ echo " <div class='spacer'> <div class='centerMenuBox'> <div class='centerMenuHeader'>{$caption}</div> <div class='centerMenuContent'>{$text}</div> </div> </div> "; }else{ echo " <div class='spacer'> <div class='otherMenuBox'> <div class='otherMenuHeader'>{$caption}</div> <div class='otherMenuContent'>{$text}</div> </div> </div> "; } }- style.css file:
/* THE FOLLOWING AREA ONLY DEALS WITH THE GRAPHICS FOR THE RANDOM NEWS AND MENU BLOCKS. * DO NOT MODIFY THESE UNLESS YOU ARE CHANGING THE GRAPHIC. TO CHANGE OTHER CHARACTERISTICS * JUST USE THE SAME NAME OF THE STYLE ABOVE (BE CAREFUL YOU DO NOT OVERWRITE THESE ATTRIBUTES * THOUGH. */ /* THE NEXT FEW STYLES EFFECT THE CAPTIONS */ /* MENUS (CAPTION AREA) */ /* Menus Titles, Captions Backgrounds */ /* red - dimensions (210, 50) */ .menuTitle_1_bg { background: url(images/red_menuheader.gif) no-repeat top left; width: 210px; height: 50px; } /* green - dimensions (210, 50) */ .menuTitle_2_bg { background: url(images/green_menuheader.gif) no-repeat top left; width: 210px; height: 50px; } /* blue - dimensions (210, 50) */ .menuTitle_3_bg { background: url(images/blue_menuheader.gif) no-repeat top left; width: 210px; height: 50px; } /* yellow - dimensions (210, 50) */ .menuTitle_4_bg { background: url(images/yellow_menuheader.gif) no-repeat top left; width: 210px; height: 50px; } /* Menu Title, Captions Text */ .menuTitle_1_text { font: bold 15px tahoma, verdana, arial, sans-serif; color: #ffd3d6; padding: 8px 10px; } /* RED */ .menuTitle_2_text { font: bold 15px tahoma, verdana, arial, sans-serif; color: #f3f7ef; padding: 8px 10px; } /* GREEN */ .menuTitle_3_text { font: bold 15px tahoma, verdana, arial, sans-serif; color: #d5f1f3; padding: 8px 10px; } /* BLUE */ .menuTitle_4_text { font: bold 15px tahoma, verdana, arial, sans-serif; color: #eeedd9; padding: 8px 10px; } /* YELLOW */ /* MENUS (BODY AREA) */ .menuBody { font: 12px tahoma, verdana, arial, sans-serif; color: #6b6b6b; padding: 10px; background: url(images/menucontent_bg.gif) repeat-y left top; } /* MENUS (BOTTOM AREA) */ /* red - dimensions (210, 20) */ .menuBottom_1_bg { background: url(images/red_menubottom.gif) no-repeat top left; width: 210px; height: 20px; } /* green - dimensions (210, 20) */ .menuBottom_2_bg { background: url(images/green_menubottom.gif) no-repeat top left; width: 210px; height: 20px; } /* blue - dimensions (210, 20) */ .menuBottom_3_bg { background: url(images/blue_menubottom.gif) no-repeat top left; width: 210px; height: 20px; } /* yellow - dimensions (210, 20) */ .menuBottom_4_bg { background: url(images/yellow_menubottom.gif) no-repeat top left; width: 210px; height: 20px; }2. variáció az irányított, fix menü fejrész Itt lényeges, hogy egy-egy menüt határozol meg.
function tablestyle($caption, $text, $mode){ global $style; if($style == "leftmenu"){ if ($mode=='camsonline_menu') { echo " <div class='spacer'> <div class='login_box'> <div class='login_top'><img src='".THEME_ABS."images/blank.gif' width='193' height='9' alt='' style='display: block;' /></div> <div class='login_bodyarea'> <div class='login_head'>{$caption}</div> <div class='login_body'>{$text}</div> </div> <div class='login_bottom'><img src='".THEME_ABS."images/blank.gif' width='193' height='11' alt='' style='display: block;' /></div> </div> </div>"; }else{ echo " <div class='spacer'> <div class='leftmenu_box'> <div class='left_menutop'><img src='".THEME_ABS."images/blank.gif' width='193' height='11' alt='' style='display: block;' /></div> <div class='left_menumiddle'> <div class='left_menuheader'>{$caption}</div> <div class='left_menubody'>{$text}</div> </div> <div class='left_menubottom'><img src='".THEME_ABS."images/blank.gif' width='193' height='11' alt='' style='display: block;' /></div> </div> </div>"; } }else if($style == "rightmenu"){ echo " <div class='spacer'> <div class='right_menutop'><img src='".THEME_ABS."images/blank.gif' width='195' height='10' alt='' style='display: block;' /></div> <div class='right_menumiddle'> <div class='right_menuheader'>{$caption}</div> <div class='right_menubody'>{$text}</div> </div> <div class='right_menubottom'><img src='".THEME_ABS."images/blank.gif' width='195' height='10' alt='' style='display: block;' /></div> </div>"; }else if($style == "centermenu"){ echo " <div class='spacer'> <div class='centerMenuBox'> <div class='centerMenuHeader_bg'> <div class='centerMenuHeaderText'>{$caption}</div> </div> <div class='centerMenuBody'>{$text}</div> </div> </div>"; }else if($style == "bottommenu"){ echo " <div class='spacer'> <div class='bottomMenuBox'> <div class='bottomMenuHeader'>{$caption}</div> <div class='bottomMenuContent'>{$text}</div> </div> </div>"; }else if($style == "adminmenu"){ echo " <div class='spacer'> <div class='adminMenuBox'> <div class='adminMenuHeader'>{$caption}</div> <div class='adminMenuContent'>{$text}</div> </div> </div>"; }else{ echo " <div class='spacer'> <div class='otherMenuBox'> <div class='otherMenuHeader'>{$caption}</div> <div class='otherMenuContent'>{$text}</div> </div> </div>"; } }Ebben a lényeg az $mode változó, ezzel adod meg a pontos menüt. Itt a style.css file tartalma már adja magát, csak meg kell adnod egy különálló stílus változót neki. Remélem érthető.