static function url($info,$page=null,$relative=false) { if ($info['linkto']) return $info['linkto']; if(front::$get['t'] == 'wap'){ if (config::get('wap_html_prefix')){ $html_prefix='/'.trim(config::get('wap_html_prefix'),'/'); } if(front::$rewrite){ if (!$page){ return config::get('site_url').'show_wap_'.$info['aid'].'.htm'; }else{ return config::get('site_url').'show_wap_'.$info['aid'].'_'.$page.'.htm'; } } $type=category::getInstance(); if($info['iswaphtml'] == 2){ return url::create('archive/show/t/wap/aid/'.$info['aid']); } if (!category::getarciswaphtml($info)){ if ($page){ return url::create('archive/show/t/wap/aid/'.$info['aid'].'/page/'.$page); }else{ return url::create('archive/show/t/wap/aid/'.$info['aid']); } }else { if ($info['htmlrule']){ $rule=$info['htmlrule']; }else{ $rule=category::gethtmlrule($info['catid'],'showhtmlrule'); } $rule=str_replace('{$caturl}',$type->htmlpath($info['catid']),$rule); $rule=str_replace('{$dir}',$type->category[$info['catid']]['htmldir'],$rule); $rule=str_replace('{$catid}',$info['catid'],$rule); $rule=str_replace('{$aid}',$info['aid'],$rule); if ($page){ $rule=str_replace('{$page}',$page,$rule); }else{ $rule=preg_replace('/\(.*?\)/','',$rule); $rule=str_replace('_{$page}','',$rule); } $rule=preg_replace('/[\(\)]/','',$rule); $rule=preg_replace('%[\\/]index\.htm1%','',$rule); $rule=rtrim($rule,'/'); $rule=trim($rule,'\\'); if ($relative) return $html_prefix.'/'.$rule; return config::get('base_url').$html_prefix.'/'.$rule; } } if (config::get('html_prefix')) $html_prefix='/'.trim(config::get('html_prefix'),'/'); $type=category::getInstance(); if($info['ishtml'] == 2){ return url::create('archive/show/aid/'.$info['aid']); } if (!category::getarcishtml($info) ||front::$rewrite) if ($page) return url::create('archive/show/aid/'.$info['aid'].'/page/'.$page); else return url::create('archive/show/aid/'.$info['aid']); else { if ($info['htmlrule']) $rule=$info['htmlrule']; else $rule=category::gethtmlrule($info['catid'],'showhtmlrule'); $rule=str_replace('{$caturl}',$type->htmlpath($info['catid']),$rule); $rule=str_replace('{$dir}',$type->category[$info['catid']]['htmldir'],$rule); $rule=str_replace('{$catid}',$info['catid'],$rule); $rule=str_replace('{$aid}',$info['aid'],$rule); if ($page){ $rule=str_replace('{$page}',$page,$rule); }else{ $rule=preg_replace('/\(.*?\)/','',$rule); $rule=str_replace('_{$page}','',$rule); } $rule=preg_replace('/[\(\)]/','',$rule); $rule=preg_replace('%[\\/]index\.htm1%','',$rule); $rule=rtrim($rule,'/'); $rule=trim($rule,'\\'); if ($relative) return $html_prefix.'/'.$rule; return config::get('base_url').$html_prefix.'/'.$rule; } }
static function url($catid,$page=null,$relative=false) { //var_dump(front::$get); $category=self::getInstance(); if (@$category->category[$catid]['linkto']) return $category->category[$catid]['linkto']; if(front::get('t')=='wap'){ if (config::get('wap_html_prefix')){ $wap_html_prefix='/'.trim(config::get('wap_html_prefix'),'/'); } if(front::$rewrite){ if (!$page){ return config::get('site_url').'list_wap_'.$catid.'.htm'; }else{ return config::get('site_url').'list_wap_'.$catid.'_'.$page.'.htm'; } } if (!category::getiswaphtml($catid)) { if (!$page){ return url::create('archive/list/t/wap/catid/'.$catid); }else{ return url::create('archive/list/t/wap/catid/'.$catid.'/page/'.$page); } }else{ $rule=category::gethtmlrule($catid,'listhtmlrule'); $rule=str_replace('{$caturl}',$category->htmlpath($catid),$rule); $rule=str_replace('{$dir}',$category->category[$catid]['htmldir'],$rule); $rule=str_replace('{$catid}',$catid,$rule); if ($category->category[$catid]['ispages'] &&!$page) $page=1; if ($page) $rule=str_replace('{$page}',$page,$rule); else $rule=preg_replace('/\(.*?\)/','',$rule); $rule=preg_replace('%/\.html$%','/index.html',$rule); $rule=preg_replace('/[\(\)]/','',$rule); $rule=preg_replace('%[\\/]index\.htm(l)?%','',$rule); $rule=rtrim($rule,'/'); $rule=trim($rule,'\\'); if ($relative) return $wap_html_prefix.'/'.$rule; $rule=str_replace('/1.html','',$rule); $path = config::get('base_url').$wap_html_prefix.'/'.$rule; //echo $path; return $path; } } if (config::get('html_prefix')) $html_prefix='/'.trim(config::get('html_prefix'),'/'); if (!category::getishtml($catid) ||front::$rewrite) { if (!$page) return url::create('archive/list/catid/'.$catid); else return url::create('archive/list/catid/'.$catid.'/page/'.$page); } else { $rule=category::gethtmlrule($catid,'listhtmlrule'); $rule=str_replace('{$caturl}',$category->htmlpath($catid),$rule); $rule=str_replace('{$dir}',$category->category[$catid]['htmldir'],$rule); $rule=str_replace('{$catid}',$catid,$rule); if ($category->category[$catid]['ispages'] &&!$page) $page=1; if ($page) $rule=str_replace('{$page}',$page,$rule); else $rule=preg_replace('/\(.*?\)/','',$rule); $rule=preg_replace('%/\.html$%','/index.html',$rule); $rule=preg_replace('/[\(\)]/','',$rule); $rule=preg_replace('%[\\/]index\.htm(l)?%','',$rule); $rule=rtrim($rule,'/'); $rule=trim($rule,'\\'); if ($relative) return $html_prefix.'/'.$rule; $rule=str_replace('/1.html','',$rule); return config::get('base_url').$html_prefix.'/'.$rule; } }