校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 網站建設 > 建站知識 > Dedecms 文章列表動態調用

Dedecms 文章列表動態調用

POST TIME:2018-09-02 13:05

啥都不說了,這個頁面就是用于ajax的,直接上代碼,哈哈,喜歡的人到時候送我幾個IP就行了

1. <?php
2. require_once(dirname(__FILE__)."/../include/common.inc.php");
3. require_once(dirname(__FILE__)."/../include/channelunit.func.php");
4.
5.
6. foreach($_REQUEST as $k=>$v)
7. {
8. $$k=$v;
9. }
10.
11.
12. if (empty($order)) $order = "pubdate";
13. if (empty($orderway)) $orderway = "desc";
14. if (empty($rs_start)) $rs_start = 0;
15. if (empty($rs_end)) $rs_end = 10;
16.
17. $wherejoin = array();
18.
19. if (!empty($arcid)) $wherejoin[]= " arc.id in ($arcid) ";
20. if (!empty($tid)) $wherejoin[]=" arc.typeid=’$tid’ ";
21.
22. $wheresql = join(‘ and ‘,$wherejoin);
23. if (!empty($wheresql)) $wheresql="where " . $wheresql;
24.
25. if (empty($mod)) $mod=’static’;
26.
27.
28.
29. $query = "Select arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,
30. tp.moresite,tp.sitepath,tp.siteurl
31. from `dede_archives` arc left join `dede_arctype` tp on arc.typeid=tp.id
32. $wheresql order by $order $orderway limit $rs_start,$rs_end
33. ";
34.
35.
36.
37. $dsql->SetQuery($query);
38. $dsql->Execute();
39.
40.
41. while($row = $dsql->GetArray())
42. {
43.
44. if ($mod==’static’)
45. {
46.
47. $row['filename'] = $row['arcurl'] = GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'],
48. $row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']);
49.
50. $arcurl="{$row['filename']}";
51.
52. }
53.
54. else if ($mod==’dynamic’)
55. {
56.
57. $arcurl="/plus/view.php?aid={$row['id']}";
58.
59. }
60.
61.
62. echo "<li><a href=’$arcurl’>{$row['title']}</a></li>";
63.
64.
65. }
66. ?>

獲取方法

網站最新文章10篇 /plus/typearc.php
網站最新文章20篇 /plus/typearc.php?rs_end=20
網站最新文章從第5條開始的10條記錄 /plus/typearc.php?rs_start=5&rs_end=10
網站文章按照id順序排列 /plus/typearc.php?order=id&orderway=asc
網站欄目id為8的最新文章10篇 /plus/typearc.php?tid=8
文章id為178和179的文章 /plus/typearc.php?arcid=178,179
獲得靜態的文章鏈接 /plus/typearc.php?mod=static
獲取動態的文章鏈接 /plus/typearc.php?mod=dynamic

獲取方法示例(jquery.ajax)

function gettypearc(id,Element){
$.ajax({
type: "POST",
url: ‘plus/typearc.php’,
data: ‘mod=dynamic&tid=’+id,
success: function(html){
$(Element).html(html);
}
});
}

<a href="javascript:" onclick="gettypearc(’8′,’type8′)">刷新文章列表</a>
<div id=’type8′>
{dede:arclist
…..
}
</div>

這樣文章就能填充進來了

文章來自 dede論壇 作者liujin834




收縮
  • 微信客服
  • 微信二維碼
  • 電話咨詢

  • 400-1100-266
主站蜘蛛池模板: 奉新县| 龙游县| 西丰县| 志丹县| 波密县| 财经| 湄潭县| 武夷山市| 遵化市| 五常市| 安新县| 仙游县| 阿克| 通辽市| 孟连| 江达县| 新泰市| 靖边县| 安顺市| 松阳县| 东至县| 青田县| 丹棱县| 鲁甸县| 长岛县| 朔州市| 邻水| 奉贤区| 新蔡县| 温宿县| 湖南省| 六盘水市| 聂荣县| 黄山市| 犍为县| 馆陶县| 古交市| 乌拉特中旗| 芜湖县| 赤峰市| 灵武市|