日日麻批-日日麻批免费视频-日日麻批免费视频播放-日日麻批视频-国产4tube在线播放-国产69精品久久久久9999

快消品貨源批發市場
快消品貨源分銷平臺
 
 
當前位置: 貨源批發網 » 網商學院 » 獨立商城 » DT(destoon) 標簽解析原理

DT(destoon) 標簽解析原理

放大字體  縮小字體 發布日期:2024-09-01 07:01:47  來源:電商聯盟  作者:樂發網  瀏覽次數:3

DT(destoon) 標簽解析原理
<?php
defined('IN_DESTOON') or exit('Access Denied');


function tag($parameter, $expires = 0) {
// $DT 網站配置
// $CFG 網站配置
// $MODULE 模塊配置
// $CATEGORY 當前模塊分類信息
// $db 數據庫操作對象
// $DCAT ★★★
// $DT_TIME 當前時間戳
global $DT, $CFG, $MODULE, $CATEGORY, $db, $DCAT, $DT_TIME;

// $CATBAK 當前模塊的分類信息,作為備份使用
$CATBAK = $CATEGORY ? $CATEGORY : array();

if($expires > 0) {
// TAG(標簽)自定義緩存$expires秒;
$tag_expires = $expires;
} else if($expires == -2) {
// SQL查詢緩存,數據庫緩存
$tag_expires = $CFG['db_expires'];
} else if($expires == -1) {
// TAG(標簽)不緩存;
$tag_expires = 0;
} else {
// TAG(標簽)默認配置緩存;
$tag_expires = $CFG['tag_expires'];
}

// 定義TAG(標簽)緩存的變量
$tag_cache = false;

// 定義SQL查詢緩存,數據庫緩存的變量
$db_cache = ($expires == -2 || defined('TOHTML')) ? 'CACHE' : '';

// 定義了tag緩存 && 不是SQL查詢緩存 && 參數字符串不含有&page=字符串(即列表分頁不緩存數據)
if($tag_expires && $db_cache != 'CACHE' && strpos($parameter, '&page=') === false) {
$tag_cache = true;

// tag緩存的文件
$TCF = DT_CACHE.'/tag/'.md5($parameter).'.htm';

// 存在tag緩存文件 并且 緩存文件的生成時間在 TAG(標簽)緩存時間的有效時間內,讀取緩存文件
if(is_file($TCF) && ($DT_TIME - filemtime($TCF) < $tag_expires)) {
echo substr(file_get($TCF), 17);
return;
}
}

// ★★★
$parameter = str_replace(array('&', '%'), array('', '##'), $parameter);

// 參數1轉為變量
parse_str($parameter, $par);

// 空數組,直接返回
if(!is_array($par)) return '';

$par = dstripslashes($par);

extract($par);

######################## 參數 #######################
// 表前綴 無用的代碼,呵呵
isset($prefix) or $prefix = $db->pre;
// 模塊id
isset($moduleid) or $moduleid = 1;
// 不存在模塊,返回
if(!isset($MODULE[$moduleid])) return '';
// fields指查詢的字段,默認為*,可以傳遞例如 fields=title,addtime
isset($fields) or $fields = '*';
// 分類id
isset($catid) or $catid = 0;
// 是否包含分類兒子
isset($child) or $child = 1;
// 地區id
isset($areaid) or $areaid = 0;
// 是否包含地區分類兒子
isset($areachild) or $areachild = 0;
// 定義緩存的目錄
isset($dir) or $dir = 'tag';
// tag默認使用list模板
isset($template) or $template = 'list';
// 定義sql條件變量
isset($condition) or $condition = '1';
// 定義group條件變量
isset($group) or $group = '';
// 定義頁碼變量
isset($page) or $page = 1;
// 定義查詢記錄條數變量
isset($pagesize) or $pagesize = 10;
// ★★★
isset($update) or $update = 0;
// 定義排序變量
isset($order) or $order = '';
// 定義是否顯示分頁變量
isset($showpage) or $showpage = 0;
// 定義日期類型變量
isset($datetype) or $datetype = 0;
// 定義鏈接窗口變量
isset($target) or $target = '';
//
isset($class) or $class = '';
// 定義簡介長度變量
isset($length) or $length = 0;
// 定義簡介變量
isset($introduce) or $introduce = 0;
// 定義調試變量
isset($debug) or $debug = 0;
// 定義列變量(模板中表格使用)
isset($cols) && $cols or $cols = 1;
// ★★★
isset($DCAT) or $DCAT = array();
if(isset($DCAT[$moduleid])) {
$CATEGORY = $DCAT[$moduleid];
} else {
$CATEGORY = $DCAT[$moduleid] = cache_read('category-'.$moduleid.'.php');
}


if($catid && $moduleid > 4) {
if(is_numeric($catid)) {
$condition .= ($child && $CATEGORY[$catid]['child']) ? " AND catid IN (".$CATEGORY[$catid]['arrchildid'].")" : " AND catid=$catid";
} else {
if($child) {
$_catids = explode(',', $catid);
$catids = '';
foreach($_catids as $_c) {
$catids .= ','.($CATEGORY[$_c]['child'] ? $CATEGORY[$_c]['arrchildid'] : $_c);
}
$catids = substr($catids, 1);
$condition .= " AND catid IN ($catids)";
} else {
$condition .= " AND catid IN ($catid)";
}
}
}

if($areaid) {
$AREA = cache_read('area.php');
if(is_numeric($areaid)) {
$condition .= ($areachild && $AREA[$areaid]['child']) ? " AND areaid IN (".$AREA[$areaid]['arrchildid'].")" : " AND areaid=$areaid";
} else {
if($areachild) {
$_areaids = explode(',', $areaid);
$areaids = '';
foreach($_areaids as $_a) {
$areaids .= ','.($AREA[$_a]['child'] ? $AREA[$_a]['arrchildid'] : $_a);
}
$areaids = substr($areaids, 1);
$condition .= " AND areaid IN ($areaids)";
} else {
$condition .= " AND areaid IN ($areaid)";
}
}
}

// 模塊的鏈接地址
$path = $MODULE[$moduleid]['linkurl'];
// 讀取表名
$table = isset($table) ? 1 : get_table($moduleid);
// 起始記錄
$offset = ($page-1)*$pagesize;
// 估摸著是在模板中使用,表格使用的
$percent = dround(100/$cols).'%';
// 定義記錄數量
$num = 0;
// sql 分組條件
$group = $group ? " GROUP BY $group" : '';
// sql 排序條件
$order = $order ? " ORDER BY $order" : '';
// stripslashes
$condition = stripslashes($condition);
// ★★★
$condition = str_replace('##', '%', $condition);

// ★★★
if($showpage) {
$num = $db->count($table, $condition.$group, $tag_expires ? $tag_expires : $CFG['db_expires']);
if($catid) {
if($page < 3 && $update) update_item($catid, $num);
$pages = listpages($moduleid, $catid, $num, $page, $pagesize, $CATEGORY);
} else {
$pages = pages($num, $page, $pagesize);
}
}

// $template為null,使用SQL查詢緩存,數據庫緩存
if($template == 'null') $db_cache = 'CACHE';

// sql
$query = "SELECT $fields FROM {$table} WHERe {$condition}{$group}{$order} LIMIT $offset,$pagesize";

// 調試
if($debug) echo $parameter.'<br/>'.$query.'<br/>';

//
$tags = array();

// rs
$result = $db->query($query, $db_cache, $tag_expires);

// rs 2 array
while($r = $db->fetch_array($result)) {
if(isset($r['title'])) {
$r['title'] = str_replace('"', '"', trim($r['title']));
$r['alt'] = $r['title'];
if($length) $r['title'] = dsubstr($r['title'], $length);
if(isset($r['style']) && $r['style']) $r['title'] = set_style($r['title'], $r['style']);
}
if(isset($r['introduce']) && $introduce) $r['introduce'] = dsubstr($r['introduce'], $introduce);
if(isset($r['linkurl']) && $r['linkurl'] && strpos($r['linkurl'], '://') === false) $r['linkurl'] = $path.$r['linkurl'];
$tags[] = $r;
}

// 不tag緩存,返回array
if($template == 'null') {
$CATEGORY = $CATBAK;
return $tags;
}

// 生成tag緩存
if($tag_cache) {
ob_start();
include template($template, $dir);
$contents = ob_get_contents();
ob_clean();
file_put($TCF, '<!--'.($DT_TIME + $tag_expires).'-->'.$contents);
$CATEGORY = $CATBAK;
echo $contents;
// 不tag緩存,返回array
} else {
include template($template, $dir);
$CATEGORY = $CATBAK;
}
}
?>

樂發網超市批發網提供超市貨源信息,超市采購進貨渠道。超市進貨網提供成都食品批發,日用百貨批發信息、微信淘寶網店超市采購信息和超市加盟信息.打造國內超市采購商與批發市場供應廠商搭建網上批發市場平臺,是全國批發市場行業中電子商務權威性網站。

本文內容整合網站:百度百科知乎淘寶平臺規則

本文來源: DT(destoon) 標簽解析原理

分享與收藏:  網商學院搜索  告訴好友  關閉窗口  打印本文 本文關鍵字:
 
更多..資源下載
獨立商城圖文
獨立商城網商學院推薦
獨立商城點擊排行
 
手機版 手機掃描訪問
主站蜘蛛池模板: 欧美激情国内自拍偷 | 美女精品永久福利在线 | 成人午夜亚洲影视在线观看 | 一本大道香蕉大vr在线吗视频 | 日韩国产欧美一区二区三区在线 | 亚洲无吗 | 亚洲综合精品一区二区三区中文 | 不卡无毒免费毛片视频观看 | 亚洲成av人片在线观看无码 | 在线观看国产精品一区 | 亚洲成aⅴ人在线观看 | 国产自愉自愉全免费高清 | 国产精品亚洲第一区柳州莫青 | aaa一级特黄| 男人天堂社区 | 欧美日韩精品一区二区三区高清视频 | zztt40.su黑料不打烊官网 | 亚洲日韩视频 | 国产精品九九久久一区hh | 视频一区二区三区在线 | 国产一区二区精品在线观看 | 一区二区三区四区在线视频 | 欧美一级aⅴ毛片 | 在线观看精品视频一区二区三区 | 91精品欧美综合在线观看 | 亚洲视频国产精品 | 一区在线看 | 国产精品在线观看 | 猛操美女 | 国产浮力第一页草草影院 | 特级毛片在线播放 | 亚洲深夜福利视频 | 中文字幕福利 | 全部孕妇毛片丰满孕妇孕交 | 久久精视频 | 性欧美精品久久久久久久 | 成人午夜视频一区二区国语 | 国产亚洲欧美日韩国产片 | 国模偷拍在线观看免费视频 | 亚洲福利精品一区二区三区 | 99久久亚洲 |