在dede5.金沙js娱乐场官方网站:6gbk版测试成功,本文实例讲述了织梦DeDeCMS动态热点文章排行调用方法

本文实例讲述了织梦DeDeCMS动态热点文章排行调用方法,想要显示本类的热点文章排行,$v){,require,//包含配置文件,在dede5.6gbk版测试成功,最新dedecms5.6删除文章对应删除图片

//这是新加的代码,表示typeid
if(isset($typeID)) $tid = $typeID;
$typeID = $tid = (isset($tid) && is_numeric($tid)) ? $tid : 0;
if($tid==0) die(” document.write(‘Request Error!’); “);
$pv = new PartView($typeid=$typeID);
$row = $pv->dsql->GetOne(” SELECT * FROM `dede_mytag` WHERE
aid=’$aid’ “);
if(!is_array($row))
{
$myvalues = ” “;
}
else
{
$tagbody = $row[‘normbody’];
$pv->SetTemplet($tagbody, ‘string’);
$myvalues = $pv->GetResult();
$myvalues = str_replace(‘”‘,’\”‘,$myvalues);
$myvalues = str_replace(“\r”,”\\r”,$myvalues);
$myvalues = str_replace(“\n”,”\\n”,$myvalues);
$myvalues = ” \r\n”;
//file_put_contents($cacheFile, $myvalues);
echo $myvalues; //不写入缓存文件,直接输出JS代码
}
调用时用就OK了,注释标注部分是新建的文件和增加的tid指定,其他的动态调用我觉得道理差不多,DeDeCMS全站静态,个别的地方动态,通过JS方式实现.

————*/
?>

复制代码代码如下:
{dede:arclist orderby=id orderway=desc typeid=1 limit=’0,10′ }

\dede\inc\inc_batchup.php

希望本文所述对大家的dedecms建站有所帮助。

复制代码代码如下:
$id = isset($id) && is_numeric($id) ? $id : 0;
$hash = md5($link);
$query = “select click from dede_archives where id=’$aid'”;
$row = $dsql->GetOne($query);
$query = “update dede_archives set click=click+1 where id=’$aid'”;
$dsql->ExecNoneQuery($query);

第二步:建立模板文件(news.htm),加入dedecms标签代码,例如下列代码调用网站栏目id=1中前十条文章的标题和链接:

复制代码代码如下:
function DelArc($aid,$type=’ON’,$onlyfile=false)
{
global $dsql,$cfg_cookie_encode,$cfg_multi_site,$cfg_medias_dir;
global $cuserLogin,$cfg_upload_switch,$cfg_delete,$cfg_basedir;
global $admin_catalogs, $cfg_admin_channel;
if($cfg_delete == ‘N’) $type = ‘OK’;
if(empty($aid)) return ;
$aid = ereg_replace(“[^0-9]”, ”, $aid);
$arctitle = $arcurl = ”;
//查询表信息
$query = “Select ch.maintable,ch.addtable,ch.nid,ch.issystem From
`dede_arctiny` arc
left join `dede_arctype` tp on tp.id=arc.typeid
left join `dede_channeltype` ch on ch.id=arc.channel where
arc.id=’$aid’ “;
$row = $dsql->GetOne($query);
$nid = $row[‘nid’];
$maintable = (trim($row[‘maintable’])==” ? ‘dede_archives’ :
trim($row[‘maintable’]));
$addtable = trim($row[‘addtable’]);
$issystem = $row[‘issystem’];
//查询档案信息
if($issystem==-1)
{
$arcQuery = “Select arc.*,tp.* from `$addtable` arc left join
`dede_arctype` tp on arc.typeid=tp.id where arc.aid=’$aid’ “;
}
else
{
$arcQuery = “Select arc.*,tp.*,arc.id as aid from `$maintable` arc
left join `dede_arctype` tp on arc.typeid=tp.id where arc.id=’$aid’
“;
}
$arcRow = $dsql->GetOne($arcQuery);
$arcBodyRow = GetArcBody($aid);
//检测权限
if(!TestPurview(‘a_Del,sys_ArcBatch’))
{
if(TestPurview(‘a_AccDel’))
{
if( !in_array($arcRow[‘typeid’], $admin_catalogs) &&
(count($admin_catalogs) != 0 || $cfg_admin_channel != ‘all’) )
{
return false;
}
}
else if(TestPurview(‘a_MyDel’))
{
if($arcRow[‘mid’] != $cuserLogin->getUserID())
{
return false;
}
}
else
{
return false;
}
}
//$issystem==-1 是单表模型,不使用回收站
if($issystem == -1) $type = ‘OK’;
if(!is_array($arcRow)) return false;
/** 删除到回收站 **/
if($cfg_delete == ‘Y’ && $type == ‘ON’)
{
$dsql->ExecuteNoneQuery(“Update `$maintable` set arcrank=’-2′ where
id=’$aid’ “);
$dsql->ExecuteNoneQuery(“Update `dede_arctiny` set `arcrank` =
‘-2’ where id = ‘$aid’; “);
}
else
{
//删除数据库记录
if(!$onlyfile)
{
//删除相关附件
if($cfg_upload_switch == ‘Y’)
{
$dsql->Execute(“me”, “SELECT * FROM `dede_uploads` WHERE arcid =
‘$aid'”);
while($row = $dsql->GetArray(‘me’))
{
$addfile = $row[‘url’];
$aid = $row[‘aid’];
$dsql->ExecuteNoneQuery(“Delete From `dede_uploads` where aid =
‘$aid’ “);
$upfile = $cfg_basedir.$addfile;
if(@file_exists($upfile)) @unlink($upfile);
}
}
$dsql->ExecuteNoneQuery(“Delete From `dede_arctiny` where
id=’$aid'”);
if($addtable != ”)
{
$dsql->ExecuteNoneQuery(“Delete From `$addtable` where aid=’$aid’
“);
}
if($issystem != -1)
{
$dsql->ExecuteNoneQuery(“Delete From `dede_archives` where
id=’$aid’ “);
}
$dsql->ExecuteNoneQuery(“Delete From `dede_feedback` where
aid=’$aid’ “);
$dsql->ExecuteNoneQuery(“Delete From `dede_member_stow` where
aid=’$aid’ “);
$dsql->ExecuteNoneQuery(“Delete From `dede_taglist` where
aid=’$aid’ “);
$dsql->ExecuteNoneQuery(“Delete From `dede_erradd` where
aid=’$aid’ “);
}
//删除文本数据
$filenameh =
DEDEDATA.”/textdata/”.(ceil($aid/5000)).”/{$aid}-“.substr(md5($cfg_cookie_encode),0,16).”.txt”;
if(@is_file($filenameh)) @unlink($filenameh);
}
if(empty($arcRow[‘money’])) $arcRow[‘money’] = 0;
if(empty($arcRow[‘ismake’])) $arcRow[‘ismake’] = 1;
if(empty($arcRow[‘arcrank’])) $arcRow[‘arcrank’] = 0;
if(empty($arcRow[‘filename’])) $arcRow[‘filename’] = ”;
//删除HTML
if($arcRow[‘ismake’]==-1 || $arcRow[‘arcrank’]!=0 ||
$arcRow[‘typeid’]==0 || $arcRow[‘money’]>0)
{
return true;
}
//强制转换非多站点模式,以便统一方式获得实际HTML文件
$GLOBALS[‘cfg_multi_site’] = ‘N’;
$arcurl =
GetFileUrl($arcRow[‘aid’],$arcRow[‘typeid’],$arcRow[‘senddate’],$arcRow[‘title’],$arcRow[‘ismake’],
$arcRow[‘arcrank’],$arcRow[‘namerule’],$arcRow[‘typedir’],$arcRow[‘money’],$arcRow[‘filename’]);
if(!ereg(“\?”, $arcurl))
{
$htmlfile =
GetTruePath().str_replace($GLOBALS[‘cfg_basehost’],”,$arcurl);
if(file_exists($htmlfile) && !is_dir($htmlfile))
{
@unlink($htmlfile);
$arcurls = explode(“.”, $htmlfile);
$sname = $arcurls[count($arcurls)-1];
$fname = ereg_replace(“(\.$sname)$”, “”, $htmlfile);
for($i=2; $i<=100; $i++)
{
$htmlfile = $fname.”_{$i}.”.$sname;
if( @file_exists($htmlfile) ) @unlink($htmlfile);
else break;
}
}
}
//解析Body中的资源,并删除
$willDelFiles =
GetPicsTruePath($arcBodyRow[‘body’],$arcRow[‘litpic’]);
$nowtime = time();
$executetime = MyDate(‘Y-m-d H:i:s’,$nowtime);//获得执行时间
$msg = “\r\n文章标题:$arcRow[title]”;
WriteToDelFiles($msg);
if(!empty($willDelFiles))
{
foreach($willDelFiles as $file)
{
if(file_exists($file) && !is_dir($file))
{
if(unlink($file)) $msg =
“\r\n位置:$file\r\n结果:删除成功!\r\n时间:$executetime”;
else $msg =
“\r\n位置:$file\r\n结果:删除失败!\r\n时间:$executetime”;
}
else $msg =
“\r\n位置:$file\r\n结果:文件不存!\r\n时间:$executetime”;
WriteToDelFiles($msg);
}//END foreach
}
else
{
$msg =
“\r\n未在Body中解析到数据\r\nBody原始数据:$arcBodyRow[body]\r\n时间:$executetime”;
WriteToDelFiles($msg);
}
return true;
}
//获取真实路径
function GetTruePath($siterefer=”, $sitepath=”)
{
$truepath = $GLOBALS[‘cfg_basedir’];
return $truepath;
}
?>

在DEDEcms的列表模板和文章模板中,想要显示本类的热点文章排行,是这样调用的:

2.找到plus\disdls.php,用以下代码全部替换
复制代码代码如下:

require_once
(dirname(apizl_file).’/../include/common.inc.php’);//包含配置文件
require_once DEDEINC.’/arc.partview.class.php’;//包含partiew类
$tempfile = ‘news.htm’;//定义模板路径
$pv = new PartView();//初始化类
$pv->SetTemplet($tempfile);//设定模板文件路径
$pv->Display();//显示该页面
?>

修改后的文件打包下载