zoukankan      html  css  js  c++  java
  • phpcms 按价格、按销量、按时间等排序实现思路

    大体思路是在链接中加入指定排序的参数,例如我们使用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}
     
  • 相关阅读:
    DBAccess
    业务耗时及数组
    QB资料学习.01
    格式化参数
    日志记录.02_线程处理
    nginx 开启gzip
    js 变量提升和函数提升
    js 深拷贝 vs 浅拷贝
    js 伪数组 转 数组
    js 对象原型和原型链
  • 原文地址:https://www.cnblogs.com/MY0101/p/6651968.html
Copyright © 2011-2022 走看看