标签:word php程序 desc 程序 action ble 举例 grid php
大体思路是在链接中加入指定排序的参数,例如我们使用get中的order作为排序参数:
order=views 人气;order=sells 效率;order=pirce 按价格;
那么这三个排序按钮的链接举例如下:
|
1
2
3
|
<a href="/index.php?m=content&c=index&a=lists&order=views">按人气</a><a href="/index.php?m=content&c=index&a=lists&order=sells">按销量</a><a href="/index.php?m=content&c=index&a=lists&order=price">按价格</a> |
然后在对应的php程序文件或模板中获取指定排序参数:
|
1
|
$order = isset($_GET[‘order‘]) ? trim($_GET[‘order‘]).‘ desc‘ : ‘sells desc‘; |
然后在模板文章列表标签中指定排序:
|
1
2
3
|
{pc:content action="lists" catid="$catid" num="15" order="$order"}...{/pc} |
标签:word php程序 desc 程序 action ble 举例 grid php
原文地址:http://www.cnblogs.com/MY0101/p/6651968.html