<?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 `dede_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}"; //echo $query; $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;*/ ?>
|