global $wyq_menu, $lang1, $news_link, $product_link, $swf_link;
$news_link = 'list.php?tid=1'; $product_link = 'list.php?tid=27'; $lang1 = (isset($tid) && is_numeric($tid) ? $tid : 1); $swf_link = 'main.swf';
if($lang1) { $wyq_menu = getMenu($lang1); }
function getMenu($lang1) { global $news_link, $product_link, $swf_link; $wyq_sql=new DedeSql(false); $wyq_sql0=new DedeSql(false); //获取语言 while(1) { $inquery = "select * from #@__arctype where id=$lang1 and ishidden!=1"; $wyq_sql->SetQuery($inquery); $wyq_sql->execute(); if($row0 = $wyq_sql->GetArray()) { if($row0['reid'] != '0') { $lang1 = $row0['reid']; $tmp_ = explode('.swf', $row0['description']); if(count($tmp_) > 1) { $swf_link = $row0['description']; } } else { $typelink1 = GetTypeUrl1($row0['id'],$row0['typedir'],$row0['isdefault'], $row0['defaultname'],$row0['ispart'],$row0['namerule2']); break; } } } $inquery = "select * from #@__arctype where reid=$lang1 and ishidden!=1 order by sortrank desc"; $wyq_sql->SetQuery($inquery); $wyq_sql->execute(); $wyq_menu = '; while($row = $wyq_sql->GetArray()) { $typelink = GetTypeUrl1($row['id'],$row['typedir'],$row['isdefault'], $row['defaultname'],$row['ispart'],$row['namerule2']); $typename = $row['typename']; $f_link = $typelink; $f_name = $typename; $inquery = "select * from #@__arctype where reid=" . $row['id'] . " and ishidden!=1 order by sortrank"; $wyq_sql0->SetQuery($inquery); $wyq_sql0->execute(); $i = 0; while($row0 = $wyq_sql0->GetArray()) { $typelink = GetTypeUrl1($row0['id'],$row0['typedir'],$row0['isdefault'], $row0['defaultname'],$row0['ispart'],$row0['namerule2']); if($i == 0){ $wyq_menu = $wyq_menu . '. $typelink . '">'. $typename .''; $wyq_menu = $wyq_menu . '; } $typename = $row0['typename']; if($news_link != 'list.php?tid=29' && $row0['content']) { $c=explode('NEWS', $row0['content']); if(count($c) > 1) { $news_link = $typelink; continue; } } if($row0['content']){ $c=explode('PRODUCTS', $row0['content']); if(count($c) > 1) { $product_link = $typelink; } } $wyq_menu = $wyq_menu . '. $typelink . '">'. $typename .''; $i = $i + 1; } if($i != 0) { $wyq_menu = $wyq_menu . ''; } else { $wyq_menu = $wyq_menu . '. $f_link . '">'. $f_name .''; } $wyq_menu = $wyq_menu . ''; } $wyq_menu = $wyq_menu . '. $typelink1 .'">' . ($lang1 == '1' ? '首页' : 'Home') . '' . ''; return $wyq_menu; }
//栏目目录规则 function MfTypedir1($typedir) { if(eregi("^http:",$typedir)) return $typedir; $typedir = str_replace("{cmspath}",$GLOBALS['cfg_cmspath'],$typedir); $typedir = ereg_replace("/{1,}","/",$typedir); return $typedir; } //获得指定类目的URL链接 //对于使用封面文件和单独页面的情况,强制使用默认页名称 function GetTypeUrl1($typeid,$typedir,$isdefault,$defaultname,$ispart,$namerule2) { $typedir = MfTypedir1($typedir); if($isdefault==-1) { //动态 $reurl = $GLOBALS['cfg_phpurl']."/list.php?tid=".$typeid; } else if($ispart==2) { //跳转网址 $reurl = $typedir; return $reurl; } else { if($isdefault==0 && $ispart==0) { $reurl = str_replace("{page}","1",$namerule2); $reurl = str_replace("{tid}",$typeid,$reurl); $reurl = str_replace("{typedir}",$typedir,$reurl); } else { $reurl = $typedir.'/'.$defaultname; } }
if( !eregi("^http://",$reurl) ) { $reurl = ereg_replace("/{1,}",'/',$reurl); } return $reurl; }
|