<{php}> global $xoopsDB,$xoopsConfig,$xoopsModule,$aggreg; /* $canvas_left=sizeof($aggreg->blocks['canvas_left'])); $canvas_right=sizeof($aggreg->blocks['canvas_right'])); $page_topcenter=sizeof($aggreg->blocks['page_topcenter'])); $page_topleft=sizeof($aggreg->blocks['page_topleft'])); $page_topright=sizeof($aggreg->blocks['page_topright'])); */ $xoops_showlblock=empty($aggreg->blocks['canvas_left'])?false:true; $xoops_showrblock=empty($aggreg->blocks['canvas_right'])?false:true; /****取得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 , $base_color ,$lb_color , $cb_color , $rb_color , $margin_top , $margin_bottom , $bg_img , $logo_img ,$logo_position, $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 , $navbar_pos , $navbar_bg_top , $navbar_bg_bottom , $navbar_hover, $navbar_color , $navbar_color_hover , $navbar_icon, $navbar_img 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_width']=$theme_width; $default['theme_name']=$theme_name; $default['theme_type']=!empty($theme_type)?$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['base_color']=$theme_base_color; $default['lb_color']=$theme_left_color; $default['cb_color']=$theme_center_color; $default['rb_color']=$theme_right_color; $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']=!empty($theme_background_color)?$theme_background_color:#FFFFFF; $default['bg_repeat']=''; $default['bg_attachment']=''; $default['bg_position']='left top'; $default['logo_img']=''; $default['logo_position']='slide'; $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['navbar_pos']='navbar-static-top'; $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'; $default['navbar_img']=''; foreach($default as $k=>$v){ $$k=$v; $this->assign($k,$$k); } } /****設定各個區域的底色****/ $left_block=$left_block2=""; $center_block="background-color:{$cb_color};"; $right_block=$right_block2=""; /****設定各個區域的寬度****/ //TYPE1:二欄式(左右區域皆在左邊) if($theme_type=='theme_type_1'){ if($theme_kind!="bootstrap"){ if(!$xoops_showlblock and !$xoops_showrblock){ $center_width=$theme_width; }else{ $center_width=$theme_width-$lb_width-24; } $left_block.="width:{$lb_width}px;"; $center_block.="float:right; width:{$center_width}px;"; $right_block.=" width:{$rb_width}px;"; }else{ $center_width=$theme_width-$lb_width; } //TYPE2:二欄式(左右區域皆在右邊) }elseif($theme_type=='theme_type_2'){ if($theme_kind!="bootstrap"){ if(!$xoops_showlblock and !$xoops_showrblock){ $center_width=$theme_width; }else{ $center_width=$theme_width-$rb_width-24; } $left_block.="width:{$lb_width}px;"; $center_block.="float:left; width:{$center_width}px;"; $right_block.="width:{$rb_width}px;"; }else{ $center_width=$theme_width-$lb_width; } //TYPE3:二欄式(左區域在左邊,右區域在下方) }elseif($theme_type=='theme_type_3'){ if($theme_kind!="bootstrap"){ if(!$xoops_showlblock){ $center_width=$theme_width; }else{ $center_width=$theme_width-$lb_width-24; } $left_block.="float:left; width:{$lb_width}px;border-right:1px dashed #999;"; $center_block.="float:right; width:{$center_width}px;"; $right_block.="float:none; width:{$theme_width}px; clear:both;border-top:1px dashed #999;"; $left_block2=""; $right_block2.="float:left;"; }else{ $rb_width="12"; $center_width=$theme_width-$lb_width; } //TYPE4:二欄式(左區域在右邊,右區域在下方) }elseif($theme_type=='theme_type_4'){ if($theme_kind!="bootstrap"){ if(!$xoops_showrblock){ $center_width=$theme_width; }else{ $center_width=$theme_width-$rb_width-24; } $left_block.="float:right; width:{$lb_width}px;border-left:1px dashed #999;"; $center_block.="float:left; width:{$center_width}px;"; $right_block.="float:none; width:{$theme_width}px; clear:both;border-top:1px dashed #999;"; $left_block2=""; $right_block2.="float:left;"; }else{ $rb_width="12"; $center_width=$theme_width-$lb_width; } //TYPE5:三欄式標準配置 }elseif($theme_type=='theme_type_5'){ if($theme_kind!="bootstrap"){ if(!$xoops_showlblock and !$xoops_showrblock){ $center_width=$theme_width; }elseif(!$xoops_showlblock){ $center_width=$theme_width-$rb_width-1; }elseif(!$xoops_showrblock){ $center_width=$theme_width-$lb_width-1; }else{ $center_width=$theme_width-$lb_width-$rb_width-2; } $left_block.="float:left; width:{$lb_width}px;border-right:1px dashed #999;"; $center_block.="float:left; width:{$center_width}px;"; $right_block.="float:right; 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"){ if(!$xoops_showlblock and !$xoops_showrblock){ $center_width=$theme_width; }elseif(!$xoops_showlblock){ $center_width=$theme_width-$rb_width-1; }elseif(!$xoops_showrblock){ $center_width=$theme_width-$lb_width-1; }else{ $center_width=$theme_width-$lb_width-$rb_width-2; } $left_block.="float:left; width:{$lb_width}px;border-right:1px dashed #999;"; $center_block.="float:right; width:{$center_width}px;"; $right_block.="float:left; 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"){ if(!$xoops_showlblock and !$xoops_showrblock){ $center_width=$theme_width; }elseif(!$xoops_showlblock){ $center_width=$theme_width-$rb_width-1; }elseif(!$xoops_showrblock){ $center_width=$theme_width-$lb_width-1; }else{ $center_width=$theme_width-$lb_width-$rb_width-2; } $left_block.="float:right; width:{$lb_width}px;border-left:1px dashed #999;"; $center_block.="float:left; width:{$center_width}px;"; $right_block.="float:right; 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; width:{$lb_width}px;border-bottom:1px dashed #999;"; $center_block.="float:none; width:{$center_width}px;"; $right_block.="float:none; width:{$theme_width}px; clear:both;border-top:1px dashed #999;"; $left_block2.=""; $right_block2.=""; }else{ $lb_width=$center_width=$rb_width="12"; } } $this->assign('base_color',$base_color); $this->assign('content_zone',"background-color:{$base_color};"); $this->assign('leftBlocks',$left_block); $this->assign('centerBlocks',$center_block); $this->assign('rightBlocks',$right_block); $this->assign('leftBlocks2',$left_block2); $this->assign('rightBlocks2',$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設定****/ $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); } /****區塊標題設定****/ $sql="select * from ".$xoopsDB->prefix("tad_themes_blocks")." where `theme_id`='{$theme_id}'"; $result=$xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'],3, mysql_error()."
".$sql); //`theme_id`, `block_position`, `block_config`, `bt_text`, `bt_text_padding`, `bt_text_size`, `bt_bg_color`, `bt_bg_img`, `bt_bg_repeat`, `bt_radius` while($all=$xoopsDB->fetchArray($result)){ $block_position=$all['block_position']; $db[$block_position]=$all; } $block_position=array("leftBlock", "rightBlock", "centerBlock", "centerLeftBlock", "centerRightBlock", "centerBottomBlock", "centerBottomLeftBlock", "centerBottomRightBlock"); $this->assign('block_position',$block_position); $i=0; $positions=""; foreach( $block_position as $position){ $positions[$i]['block_position']=$position; $positions[$i]['block_config']=!isset($db[$position]['block_config'])?"right":$db[$position]['block_config']; $positions[$i]['bt_text']=!isset($db[$position]['bt_text'])?"#333333":$db[$position]['bt_text']; $positions[$i]['bt_text_padding']=!isset($db[$position]['bt_text_padding'])?"33":$db[$position]['bt_text_padding']; $positions[$i]['bt_text_size']=!isset($db[$position]['bt_text_size'])?"16px":$db[$position]['bt_text_size']; $positions[$i]['bt_bg_color']=!isset($db[$position]['bt_bg_color'])?"#DDEEFF":$db[$position]['bt_bg_color']; $positions[$i]['bt_bg_img']=!isset($db[$position]['bt_bg_img'])?"":$db[$position]['bt_bg_img']; $positions[$i]['bt_bg_repeat']=!isset($db[$position]['bt_bg_repeat'])?"1":$db[$position]['bt_bg_repeat']; $positions[$i]['bt_radius']=!isset($db[$position]['bt_radius'])?"0":$db[$position]['bt_radius']; $this->assign($position,$positions[$i]); $i++; } $this->assign('positions',$positions); /****佈景額外設定****/ $theme_name=$xoopsConfig['theme_set']; //額外佈景設定 if(file_exists(XOOPS_ROOT_PATH."/themes/{$theme_name}/config2.php")){ include_once XOOPS_ROOT_PATH."/themes/{$theme_name}/config2.php"; $sql="select `name`, `type`, `value` from ".$xoopsDB->prefix("tad_themes_config2")." where `theme_id`='{$theme_id}'"; $result=$xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'],3, mysql_error()."
".$sql); while(list($name,$type,$value)=$xoopsDB->fetchRow($result)){ $config2[$name]=$value; } foreach($theme_config as $k=>$config){ $name=$config['name']; $value=is_null($config2[$name])?$config['default']:$config2[$name]; $this->assign($name,$value); } } <{/php}>