风吹麦麦浪 發表於 2024-7-27 00:00:00

详解织梦标签{dede:freelist/}列表调用增加排序方式的代码

<p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;">
        如何使用自由列表标签{dede:freelist/}我这里就不多说了。</p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;">
        当你用到自由列表的时候,会发现排序方式不全。比如我所需要用到 随机排序&quot;rank&quot;和按得分排序&quot;scores&quot;这里就没有。</p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;">
        当然这两个排序dede是有的只是没有列出来,这样就简单了。</p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;">
        找到打开 dede/templets/freelist_add.htm &quot;添加自由列表模板&quot;。</p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;">
        找到</p><div class="jb51code" style="margin: 0px; padding: 0px; outline: none; line-height: 25.2px; font-size: 14px; width: 660px; overflow: hidden; clear: both; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;"><pre class="brush:xhtml;">&lt;td&nbsp;height=&quot;28″&nbsp;align=&quot;left&quot;&gt;排列顺序:</pre></div><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;">
        在这一行下面插入以下代码并保存:</p><div class="jb51code" style="margin: 0px; padding: 0px; outline: none; line-height: 25.2px; font-size: 14px; width: 660px; overflow: hidden; clear: both; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;"><pre class="brush:xhtml;">随机推荐按照得分</pre></div><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;">
        再找到打开 dede/templets/freelist_edit.htm &quot;修改自由列表模板&quot;。</p><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;">
        找到</p><div class="jb51code" style="margin: 0px; padding: 0px; outline: none; line-height: 25.2px; font-size: 14px; width: 660px; overflow: hidden; clear: both; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;"><pre class="brush:php;toolbar:false;">$orderby&nbsp;=&nbsp;$ctag-&gt;GetAtt(&#39;orderby&#39;);</pre></div><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;">
        下面参数改为以下。</p><div class="jb51code" style="margin: 0px; padding: 0px; outline: none; line-height: 25.2px; font-size: 14px; width: 660px; overflow: hidden; clear: both; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;"><pre class="brush:php;toolbar:false;">$sorta&nbsp;=&nbsp;&quot;sortrank,置顶权限值;pubdate,发布时间;senddate,录入时间;click,点击量;id,文档ID,lastpost,最后评论时间;postnum,评论总数;rand,随机推荐;scores,按照得分&quot;;</pre></div><p style="margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;">
        再找到</p><div class="jb51code" style="margin: 0px; padding: 0px; outline: none; line-height: 25.2px; font-size: 14px; width: 660px; overflow: hidden; clear: both; font-family: tahoma, arial, &quot;Microsoft YaHei&quot;;"><pre class="brush:xhtml;">&lt;select&nbsp;name=&quot;orderby&quot;&nbsp;id=&quot;orderby&quot;Microsoft&nbsp;YaHei&quot;;&#39;&gt;
        下面插入随机推荐按照得分
        保存,退出,验证。
        以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。</pre></div>
頁: [1]
查看完整版本: 详解织梦标签{dede:freelist/}列表调用增加排序方式的代码