本文整理汇总了PHP中category::getishtml方法的典型用法代码示例。如果您正苦于以下问题:PHP category::getishtml方法的具体用法?PHP category::getishtml怎么用?PHP category::getishtml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类category
的用法示例。
在下文中一共展示了category::getishtml方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: make_list_action
function make_list_action() {
$servip = gethostbyname($_SERVER['SERVER_NAME']);
if($servip==front::ip()&&front::get('ishtml')==1){
}else{
chkpw('cache_category');
}
header('Cache-control: private, must-revalidate');
@set_time_limit(0);
if (!front::post('submit'))
return;
$case = 'archive';
$act = 'list';
$_GET = array('case' => $case, 'act' => $act);
$front = new front();
front::$admin = false;
front::$html = true;
front::$rewrite = false;
$case = $case . '_act';
$case = new $case();
$case->init();
$method = $act . '_action';
$totalpage = 100;
$time_start = time::getTime();
$category = category::getInstance();
$categories = $category->sons(front::post('catid'));
$categories[] = front::post('catid');
$cpage = 0;
$archive_all = new archive();
foreach ($categories as $key => $catid) {
$new_categories = $category->sons($catid);
$new_categories[] = $catid;
$archive_num[$catid] = $archive_all->rec_count('catid in(' . implode(',', $new_categories) . ') and checked=1 and `state`=1');
}
$i = 0;
foreach ($categories as $catid) {
if ($catid == 0)
continue;
if (!category::getishtml($catid))
continue;
front::$get['catid'] = $catid;
$case->view->categories = category::getpositionlink2($catid);
$_categories = $category->sons($catid);
$_categories[] = $catid;
$case->view->ifson = category::hasson($catid);
for (front::$get['page'] = 1;; front::$get['page']++) {
$view = $case->view;
$_catpage = category::categorypages($catid);
if ($_catpage) {
$pagesize = $_catpage;
} else {
$pagesize = config::get('list_pagesize');
}
$limit = ((front::$get['page'] - 1) * $pagesize) . ',' . $pagesize;
$archive = new archive();
$tops = array();
$tops = $archive->getrows("checked=1 AND state=1 AND toppost!=0",0,'toppost DESC,listorder=0,listorder ASC,aid DESC');
if (@$category->category[$catid]['includecatarchives']) {
$case->view->archives = $archive->getrows('catid in(' . implode(',', $_categories) . ') and checked=1 and `state`=1', $limit, 'listorder=0,`listorder` asc,`adddate` DESC');
} else {
$case->view->archives = $archive->getrows("catid=$catid and checked=1 and `state`=1", $limit, 'listorder=0,`listorder` asc,`adddate` DESC');
}
$case->view->page = front::$get['page'];
if(is_array($tops) && !empty($tops)){
foreach($tops as $order => $arc){
if($arc['toppost'] == 3){
$tops[$order]['title'] = "[全站置顶]".$arc['title'];
}
if($arc['toppost'] == 2){
$subcatids = $category->sons($arc['catid']);
if($arc['catid'] != front::get('catid') && !in_array(front::get('catid'), $subcatids)){
unset($tops[$order]);
}else{
$tops[$order]['title'] = "[栏目置顶]".$arc['title'];
}
}
}
$case->view->archives = array_merge($tops , $case->view->archives);
}
foreach ($case->view->archives as $order => $arc) {
$articles = $arc;
if (!$arc['introduce'])
$arc['introduce'] = cut($arc['content'], 200);
$articles['url'] = archive::url($arc);
$articles['catname'] = category::name($arc['catid']);
$articles['caturl'] = category::url($arc['catid']);
$articles['image'] = @strstr($arc['image'], "http://") ? $arc['image'] : config::get('base_url') . '/' . $arc['image'];
$articles['strgrade'] = archive::getgrade($arc['grade']);
$articles['adddate'] = sdate($arc['adddate']);
$articles['buyurl'] = url('archive/orders/aid/' . $arc['aid']);
$articles['stitle'] = strip_tags($arc['title']);
if(strtolower(substr($arc['thumb'],0,7)) == 'http://'){
$articles['sthumb'] = $arc['thumb'];
}else{
$articles['sthumb'] = config::get('base_url').'/'.$arc['thumb'];
//.........这里部分代码省略.........
示例2: list_action
//.........这里部分代码省略.........
}
if (!is_array($articles)) {
$this->out('message/error.html');
}
if(is_array($tops) && !empty($tops)){
foreach($tops as $order => $arc){
if($arc['toppost'] == 3){
$tops[$order]['title'] = "[全站置顶]".$arc['title'];
}
if($arc['toppost'] == 2){
$subcatids = $this->category->sons($arc['catid']);
if($arc['catid'] != front::get('catid') && !in_array(front::get('catid'), $subcatids)){
unset($tops[$order]);
}else{
$tops[$order]['title'] = "[栏目置顶]".$arc['title'];
}
}
}
$articles = array_merge($tops , $articles);
}
foreach ($articles as $order => $arc) {
$articles[$order]['url'] = archive::url($arc);
$articles[$order]['catname'] = category::name($arc['catid']);
$articles[$order]['caturl'] = category::url($arc['catid']);
$articles[$order]['adddate'] = sdate($arc['adddate']);
$articles[$order]['title'] = $arc['title'];
$articles[$order]['stitle'] = strip_tags($arc['title']);
$articles[$order]['strgrade'] = archive::getgrade($arc['grade']);
$articles[$order]['buyurl']=url('archive/orders/aid/'.$arc['aid']);
if(strtolower(substr($arc['thumb'],0,7)) == 'http://'){
$articles[$order]['sthumb'] = $arc['thumb'];
}else{
$articles[$order]['sthumb'] = config::get('base_url').'/'.$arc['thumb'];
}
$prices = getPrices($articles[$order]['attr2']);
$articles[$order]['attr2'] = $prices['price'];
$articles[$order]['oldprice'] = $prices['oldprice'];
if($arc['strong']) {
$articles[$order]['title'] = '<strong>'.$arc['title'].'</strong>';
}
if($arc['color']) {
$articles[$order]['title'] = '<font style="color:'.$arc['color'].';">'.$articles[$order]['title'].'</font>';
}
/*if($arc['toppost'] == '3') {
$tmp1[] = $articles[$order];
unset($articles[$order]);
}
if($arc['toppost'] == '2' && front::get('catid') == $arc['catid']) {
$tmp2[] = $articles[$order];
unset($articles[$order]);
}*/
}
/*if(is_array($tmp1) && is_array($tmp2)) {
$articles = array_merge($tmp1,$tmp2,$articles);
}else if(is_array($tmp1) && !is_array($tmp2)) {
$articles = array_merge($tmp1,$articles);
}else if(!is_array($tmp1) && is_array($tmp2)) {
$articles = array_merge($tmp2,$articles);
}*/
$this->view->archives = $articles;
$this->view->articles = $articles;
if (@$this->category->category[front::get('catid')]['includecatarchives'])
$this->view->record_count = $this->archive->rec_count('catid in(' . implode(',', $categories) . ') AND state=1 AND checked=1');
else
$this->view->record_count = $this->archive->rec_count('catid=' . front::get('catid').' AND state=1 AND checked=1');
front::$record_count = $this->view->record_count;
$this->view->catid = front::get('catid');
$this->view->ifson = category::hasson($articles[0]['catid'] ? $articles[0]['catid'] : $this->view->catid);
$this->view->topid = category::gettopparent(front::get('catid'));
$this->view->parentid = @$this->category->getparent($this->view->catid);
if (front::get('t') == 'wap') {
$cateobj = category::getInstance();
$this->view->subids = $cateobj->son($this->view->catid);
$template = @$this->category->category[front::get('catid')]['templatewap'];
if ($template && file_exists(TEMPLATE . '/' . $this->view->_style . '/' . $template))
$this->out($template);
else {
$tpl = category::gettemplatewap($this->view->catid);
$this->out($tpl);
}
return;
}
$template = @$this->category->category[front::get('catid')]['template'];
if ($template && file_exists(TEMPLATE . '/' . $this->view->_style . '/' . $template))
$this->out($template);
else {
$tpl = category::gettemplate($this->view->catid);
if (category::getishtml($this->view->catid)) {
$path = ROOT . category::url($this->view->catid, @front::$get['page'] > 1 ? front::$get['page'] : null);
if (!preg_match('/\.[a-zA-Z]+$/', $path))
$path = rtrim(rtrim($path, '/'), '\\') . '/index.html';
$this->cache_path = $path;
}
$this->out($tpl);
}
}
示例3: 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;
}
}