一个分享个人学习、开发经验的Blog,http://www.joyphper.net

js动态调取织梦(dedeCMS)系统中的文章内容

posted @ 2010-11-26 17:19 | 阅读:3509 | 评论:1 | 分类: PHP

 

 

<?php   
require_once(dirname(__FILE__)."/include/common.inc.php");  
require_once(DEDEINC."/typelink.class.php");  
require_once(DEDEINC."/channelunit.func.php");  
$t1 = ExecTime();  
$cfg_multi_site = 'Y';//开启绝对路径  
 /**文章调用  
*参数说明  
* $tid栏目的ID号  
* $flg文章的属性  
* $num调取条数默认为6  
* $order文章的排序可靠(文章的默认排序pubdate,倒序)  
* $class控制的样式名,用于在一个页面里调取多个控制不同的样式,默认为jsArticle  
* $skip路过多少文章开始取值  
**/ 
//$tid=10;  
//$flg='a,c';  
//$num=20;  
if (!(isset($tid) && is_numeric($tid)))  
{  
    $tid=0;  
}  
if (!(isset($num) && is_numeric($num)))  
{  
    $num=6;  
}  
if (!isset($class))  
{  
    $class='jsArticle';  
}
if (!(isset($skip) && is_numeric($skip)))  
{  
    $skip=0;  
}  
$query = "Select `id`,`typeid`,`senddate`,`title`,`ismake`,`arcrank`,`money`,`filename` from `#@__archives` where 1=1 ";  
if ($tid)  
{  
    $query.=" and `typeid`='{$tid}' ";  
}  
if (isset($flg))  
{  
    //$query.=" and (1>1";  
    $flgs=explode(',',$flg);  
    foreach ($flgs as $v)  
    {  
        $query.=" and FIND_IN_SET('{$v}',`flag`)>0";  
    }  
    //$query.=")";  
}  
if (isset($order))  
{  
    $query.=" order by {$order} desc";  
}  
else   
{  
    $query.=" order by pubdate desc";  
}  
$query.=" limit {$skip},{$num}";  
$dsql->Execute('me',$query);  
while (false!=($row=$dsql->GetArray('me')))  
{  
    $TypeLink = new TypeLink($row["typeid"]);  
    $arclink = GetFileUrl(  
                        $row['id'],  
                        $row["typeid"],  
                        $row["senddate"],  
                        $row["title"],  
                        $row["ismake"],  
                        $row["arcrank"],  
                        $TypeLink->TypeInfos['namerule'],  
                        $TypeLink->TypeInfos['typedir'],  
                        $row["money"],  
                        $row['filename'],  
                        $TypeLink->TypeInfos['moresite'],  
                        $TypeLink->TypeInfos['siteurl'],  
                        $TypeLink->TypeInfos['sitepath']  
                );  
        unset($TypeLink);  
        $row['url']=$arclink;  
        $rows[]=$row;  
}  
echo "document.write('<ul id="jsArticle" class="{$class}">');";  
foreach ($rows as $row)  
{     
    echo "document.write('<li><a href="{$row['url']}" title="{$row['title']}" target="_blank" >{$row['title']}</a></li>');";  
}  
echo "document.write('</ul>');";  
$t2=ExecTime();  
/*echo '执行时间';  
echo $t2-$t1;*/ 
?> 

TAG: dedecms , 织梦 , dede , php学习

共有1条评论 发表评论>>

Crissy 发表于:2016-05-18 20:21
i have never made a pattern on my own fabric. i will usually adorn with beads, lace, etc. but that is usually on the finished garment. never before. this may be somtehing to consider in the future b/c i have seen some cool things.
点击换一张验证码