本文整理汇总了PHP中category::gethtmlrule方法的典型用法代码示例。如果您正苦于以下问题:PHP category::gethtmlrule方法的具体用法?PHP category::gethtmlrule怎么用?PHP category::gethtmlrule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类category
的用法示例。
在下文中一共展示了category::gethtmlrule方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: url
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;
}
}
示例2: url
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;
}
}