<{php}> global $xoopsDB,$xoopsConfig,$xoopsModule; /****取得Tad Themes偏好設定****/ $modhandler = &xoops_gethandler('module'); $xoopsModule = &$modhandler->getByDirname("tad_themes"); $mid=($xoopsModule)?$xoopsModule->getVar('mid'):0; $use_default_config=false; if($mid){ $config_handler = & xoops_gethandler('config'); $xoopsModuleConfig = & $config_handler->getConfigsByCat(0, $mid); $this->assign('auto_mainmenu',$xoopsModuleConfig['auto_mainmenu']); $this->assign('show_sitename',$xoopsModuleConfig['show_sitename']); /****Tad Themes的設定值****/ if(file_exists(XOOPS_ROOT_PATH."/modules/tad_themes/xoops_version.php")){ $sql="select * from ".$xoopsDB->prefix("tad_themes")." where `theme_name`='{$xoopsConfig['theme_set']}'"; $result = $xoopsDB->query($sql); $data=$xoopsDB->fetchArray($result); if(!empty($data)){ foreach($data as $k=>$v){ $$k=$v; $this->assign($k,$$k); } } //以下會產生這些變數： $theme_id , $theme_name , $theme_type , $lb_width , $rb_width , $clb_width , $crb_width , $lb_color , $cb_color , $rb_color , $margin_top , $margin_bottom , $bg_img , $logo_img, $navlogo_img , $bg_attachment , $bg_color , $bg_position , $bg_repeat , $logo_top , $logo_right , $logo_bottom , $logo_left , $theme_enable , $slide_width , $slide_height , $font_size , $font_color , $link_color , $hover_color , $theme_kind , $block_config , $bt_text , $bt_text_padding , $bt_bg_color , $bt_bg_img , $bt_bg_repeat , $bt_radius , $navbar_pos , $navbar_bg_top , $navbar_bg_bottom , $navbar_hover, $navbar_color , $navbar_color_hover , $navbar_icon if(empty($data['theme_id']))$use_default_config=true; }else{ $use_default_config=true; } }else{ $use_default_config=true; } /****若無Tad Themes的設定值，採用檔案預設值****/ if($use_default_config){ $theme_name=$xoopsConfig['theme_set']; include_once XOOPS_ROOT_PATH."/themes/{$theme_name}/config.php"; //模擬偏好設定預設值 $default['auto_mainmenu']='1'; $default['show_sitename']='1'; //模擬Tad Themes的設定值 $default['theme_id']='0'; $default['theme_name']=$theme_name; $default['theme_type']='theme_type_1'; $default['lb_width']=$theme_left_width; $default['rb_width']=$theme_right_width; $default['clb_width']='49%'; $default['crb_width']='49%'; $default['lb_color']='#F4F4F4'; $default['cb_color']='#FFFFFF'; $default['rb_color']='#F4F4F4'; $default['margin_top']='0'; $default['margin_bottom']='0'; $default['bg_img']=!empty($theme_default_background)?XOOPS_URL."/themes/{$theme_name}/images/bg/{$theme_default_background}":""; $default['bg_color']='#FFFFFF'; $default['bg_repeat']=''; $default['bg_attachment']=''; $default['bg_position']='left top'; $default['logo_img']=''; $default['navlogo_img']=''; $default['logo_top']=''; $default['logo_right']=''; $default['logo_bottom']=''; $default['logo_left']=''; $default['theme_enable']='1'; $default['slide_width']=$theme_slide_width; $default['slide_height']=$theme_slide_height; $default['font_size']='11pt'; $default['font_color']='#202020'; $default['link_color']='#3333CC'; $default['hover_color']='#FF3300'; $default['theme_kind']=$theme_kind; $default['block_config']='right'; $default['bt_text']=$theme_bt_text; $default['bt_text_padding']=$theme_bt_text_padding; $default['bt_bg_color']=$theme_bt_bg_color; $default['bt_bg_img']=!empty($theme_bt_bg_img)?XOOPS_URL."/themes/{$theme_name}/images/bt_bg/{$theme_bt_bg_img}":""; $default['bt_bg_repeat']='0'; $default['bt_radius']='1'; $default['navbar_pos']='not-use'; $default['navbar_bg_top']='#54b4eb'; $default['navbar_bg_bottom']='#2fa4e7'; $default['navbar_hover']='#1684c2'; $default['navbar_color']='#ffffff'; $default['navbar_color_hover']='#ffff00'; $default['navbar_icon']='icon-white'; foreach($default as $k=>$v){ $$k=$v; $this->assign($k,$$k); } } /****設定各個區域的底色****/ $left_block="background-color:{$lb_color};"; $center_block="background-color:{$cb_color};"; $right_block="background-color:{$rb_color};"; $left_block2=$right_block2=""; /****設定各個區域的寬度****/ //TYPE1:二欄式（左右區域皆在左邊） if($theme_type=='theme_type_1'){ if($theme_kind!="bootstrap"){ $center_width=$theme_width-$lb_width-24; $left_block.="float:left; margin:4px 4px 4px 8px;width:{$lb_width}px;border-right:1px dashed #999;"; $center_block.="float:right; margin:2px 4px 4px 2px; width:{$center_width}px;"; $right_block.="float:left; margin:2px 2px 4px 4px; width:{$rb_width}px;border-right:1px dashed #999;"; }else{ $center_width=$theme_width-$lb_width; } //TYPE2:二欄式（左右區域皆在右邊） }elseif($theme_type=='theme_type_2'){ if($theme_kind!="bootstrap"){ $center_width=$theme_width-$lb_width-24; $left_block.="float:right; margin:2px 4px 2px 2px; width:{$lb_width}px;border-left:1px dashed #999;"; $center_block.="float:left; margin:2px 2px 4px 4px; width:{$center_width}px;"; $right_block.="float:right; margin:2px 4px 4px 2px; width:{$rb_width}px;border-left:1px dashed #999;"; }else{ $center_width=$theme_width-$lb_width; } //TYPE3:二欄式（左區域在左邊，右區域在下方） }elseif($theme_type=='theme_type_3'){ if($theme_kind!="bootstrap"){ $center_width=$theme_width-$lb_width-24; $left_block.="float:left; margin:2px 2px 2px 4px; width:{$lb_width}px;border-right:1px dashed #999;"; $center_block.="float:right; margin:2px 4px 4px 2px; width:{$center_width}px;"; $right_block.="float:none; margin:2px 2px 4px 4px; width:{$slide_width}px; clear:both;border-top:1px dashed #999;"; $left_block2=""; $right_block2="float:left; min-width: {$h_block_width}px; behavior: expression(this.style.width=(document.documentElement.offsetWidth < {$h_block_width})?'{$h_block_width}px':'100%');"; }else{ $rb_width="12"; $center_width=$theme_width-$lb_width; } //TYPE4:二欄式（左區域在右邊，右區域在下方） }elseif($theme_type=='theme_type_4'){ if($theme_kind!="bootstrap"){ $center_width=$theme_width-$lb_width-24; $left_block.="float:right; margin:2px 4px 2px 2px; width:{$lb_width}px;border-left:1px dashed #999;"; $center_block.="float:left; margin:2px 0px 4px 10px; width:{$center_width}px;"; $right_block.="float:none; margin:2px 2px 4px 4px; width:{$slide_width}px; clear:both;border-top:1px dashed #999;"; $left_block2=""; $right_block2="float:left; min-width: {$h_block_width}px; behavior: expression(this.style.width=(document.documentElement.offsetWidth< {$h_block_width})?'{$h_block_width}px':'100%');"; }else{ $rb_width="12"; $center_width=$theme_width-$lb_width; } //TYPE5:三欄式標準配置 }elseif($theme_type=='theme_type_5'){ if($theme_kind!="bootstrap"){ $center_width=$theme_width-$lb_width-$rb_width-24; $left_block.="float:left; margin:2px 4px 4px 4px; width:{$lb_width}px;border-right:1px dashed #999;"; $center_block.="float:left; margin:2px 0px 4px 4px; width:{$center_width}px;"; $right_block.="float:right; margin:2px 4px 4px 0px; width:{$rb_width}px;border-left:1px dashed #999;"; $left_block2=$right_block2=""; }else{ $center_width=$theme_width-$lb_width-$rb_width; } //TYPE6:三欄式（左右區域皆在左邊） }elseif($theme_type=='theme_type_6'){ if($theme_kind!="bootstrap"){ $center_width=$theme_width-$lb_width-$rb_width-24; $left_block.="float:left; margin:2px 0px 4px 0px; width:{$lb_width}px;border-right:1px dashed #999;"; $center_block.="float:right; margin:2px 0px 4px 0px; width:{$center_width}px;"; $right_block.="float:left; margin:2px 4px 4px 0px; width:{$rb_width}px;border-right:1px dashed #999;"; $left_block2=$right_block2=""; }else{ $center_width=$theme_width-$lb_width-$rb_width; } //TYPE7:三欄式（左右區域皆在右邊） }elseif($theme_type=='theme_type_7'){ if($theme_kind!="bootstrap"){ $center_width=$theme_width-$lb_width-$rb_width-24; $left_block.="float:right; margin:2px 0px 4px 0px; width:{$lb_width}px;border-left:1px dashed #999;"; $center_block.="float:left; margin:2px 0px 4px 10px; width:{$center_width}px;"; $right_block.="float:right; margin:2px 0px 4px 0px; width:{$rb_width}px;border-left:1px dashed #999;"; $left_block2=$right_block2=""; }else{ $center_width=$theme_width-$lb_width-$rb_width; } //TYPE8:單欄式（左區域在上方，右區域在下方） }elseif($theme_type=='theme_type_8'){ if($theme_kind!="bootstrap"){ $center_width=$theme_width; $left_block.="float:none; margin:2px 4px 2px 4px; width:{$lb_width}px;border-bottom:1px dashed #999;"; $center_block.="float:none; margin:2px 4px 2px 4px; width:{$center_width}px;"; $right_block.="float:none; margin:2px 4px 2px 4px; width:{$slide_width}px; clear:both;border-top:1px dashed #999;"; $left_block2=$right_block2="float:left; min-width: {$h_block_width}px; behavior: expression(this.style.width=(document.documentElement.offsetWidth < {$h_block_width})?'{$h_block_width}px':'100%');"; }else{ $lb_width=$center_width=$rb_width="12"; } } $this->assign('leftBlock',$left_block); $this->assign('centerBlock',$center_block); $this->assign('rightBlock',$right_block); $this->assign('leftBlock2',$left_block2); $this->assign('rightBlock2',$right_block2); $this->assign('lb_width',$lb_width); $this->assign('rb_width',$rb_width); $this->assign('center_width',$center_width); /****設定Logo圖位置****/ $logo_place=""; if(!empty($logo_top))$logo_place.="top:{$logo_top}px;"; if(!empty($logo_right))$logo_place.="right:{$logo_right}px;"; if(!empty($logo_bottom))$logo_place.="bottom:{$logo_bottom}px;"; if(!empty($logo_left))$logo_place.="left:{$logo_left}px;"; $this->assign('logo_place',$logo_place); /****檢查除錯模式****/ $sql = "select conf_value from ".$xoopsDB->prefix("config")." where conf_title ='_MD_AM_DEBUGMODE'"; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'],3, mysql_error()); list($debug)=$xoopsDB->fetchRow($result); if($debug==0){ $debug=1; }else{ $debug=0; } $this->assign('debug',$debug); /****滑動圖片區設定****/ if($slide_height >= 30){ $this->assign('use_search',1); } /****導覽工具列、區塊標題CSS設定****/ if($bt_bg_repeat==0){ $bt_bg_repeat="no-repeat 5px center"; }else{ $bt_bg_repeat=""; } if($bt_radius==1){ $bt_radius="border-radius:5px"; }else{ $bt_radius=""; } if($navbar_pos=='not-use' and $theme_kind=="bootstrap"){ $navbar_pos="navbar-static-top"; } $this->assign('bt_bg_repeat',$bt_bg_repeat); $this->assign('bt_radius',$bt_radius); $this->assign('navbar_pos',$navbar_pos); $this->assign('navbar_bg_top',$navbar_bg_top); $this->assign('navbar_bg_bottom',$navbar_bg_bottom); $this->assign('navbar_hover',$navbar_hover); /****若有logo.png或logo.gif時導覽工具列以圖替代網站標題文字****/ if($navlogo_img){ $this->assign('navbar_logo_img',$navlogo_img); } <{/php}>