Weave Dream Set Column list sorting method

Source: Internet
Author: User
Tags ereg

The ordering of the label Dede:arclist is specified by the order by order, as follows:

{dede:arclist orderby= ' sort field '}

{/dede:arclist}

orderby= ' Sortrank ' document sorting method

§orderby= ' hot ' or orderby= ' click ' means by number of clicks

§orderby= ' Sortrank ' or orderby= ' pubdate ' sorted by publication time

§orderby= ' near '

§orderby== ' Lastpost ' by last review time

§orderby== ' scores ' ranked by score

§orderby= ' id ' sorted by article ID

§orderby= ' Rand ' randomly obtains a list of documents for the specified condition

Instead, the values listed above can be assigned to the order by, meaning that the dede:arclist tag can only be sorted by the fields listed above.

So how do you sort by custom fields? If you add a field OrderID to the Dede_archives table now,

If you want to sort by this field. Write this directly: {dede:arclist orderby= ' OrderID '} is not possible. How should that be changed?

First, the database operation:

Modify the Dede_archives table structure with MySQL management tools or other, add a column of OrderID fields

Second, modify the background files

1. Open dede/article_add.php//Modify code file

Change the line 187-191 to the following code:

$query = "INSERT into ' dede_archives ' (Id,typeid,typeid2,sortrank,flag,ismake,channel,arcrank,click,money,title, Shorttitle,

Color,writer,source,litpic,pubdate,senddate,mid,notpost,description,keywords,filename,dutyadmin,orderid)

VALUES (' $arcID ', ' $typeid ', ' $typeid 2′, ' $sortrank ', ' $flag ', ' $ismake ', ' $channelid ', ' $arcrank ', ' $click ', ' $money ',

' $title ', ' $shorttitle ', ' $color ', ' $writer ', ' $source ', ' $litpic ', ' $pubdate ', ' $senddate ',

' $adminid ', ' $notpost ', ' $description ', ' $keywords ', ' $filename ', ' $adminid ', ' $orderid ');

2. Open dede/article_edit.php//Modify code file

After 191 lines of dutyadmin= ' $adminid ', add a comma,

Carriage return Line Add the following code: orderid= ' $orderid ' copyright www.dedecmsmuban.com

3. Open dede/templets/article_add.htm//modify template file

4. Open dede/include/arc.listview.class.php

600 rows found

Change if (ereg (' Hot|click|lastpost ', $orderby)) to the IF (Ereg (' Hot|click|lastpost|orderid ', $orderby)) Weave Dream Template

Find 134 lines, enter add a line, add the following code:

<table width= "800″border=" 0″cellspacing= "0″cellpadding=" 0″>

<tr> www.dedecmsmuban.com

<TD width= "90″style=" color: #F00 ″> Sort Weights:</td>

<TD colspan= "3″><input type= ' text ' name= ' OrderID ' value= ' 0′style= ' width:100px; '/> (please fill in the numbers, the bigger the more forward) </td >

</tr>

</table>

4. Open dede/templets/article_edit.html//modify template file

To line 131, enter add a line, add the following code:

<table width= "800″border=" 0″cellspacing= "0″cellpadding=" 0″>

<tr>

<TD width= "90″style=" color: #F00 ″> Sort Weights:</td>

<TD colspan= "3″><input type= ' text ' name= ' OrderID ' value= ' <?php echo $arcRow [" OrderID "]?> ' style= ' width : 100px; '/> (please fill in the numbers, the bigger the more forward) </td>

<td></td>

</tr>

</table>

PS: 3rd, 4 step is to take care of the novice who is not very HTML language, if you are veteran can decide to add location.

Third, the foreground file operation:

1. Open include/arc.listview.class.php//Modify code file

To line 558, enter add a line, add the following code:

else if ($orderby = = "OrderID") {

$ordersql = "ORDER by Arc.orderid $orderWay"; OrderID Fields added to the Dede_archives table

}

2. Open include/taglib/arclist.lib.php//Modify code file

To line 233, enter add a line, add the following code:

else if ($orderby = = ' OrderID ') $ordersql = "ORDER by Arc.orderid $orderWay, Arc.id $orderWay";

This enables the operation of custom fields, and the UTF-8 version can be similarly modified.

Four, the HTML template calls as follows:

{dede:arclist typeid= ' 2′row= ' 11′titlelen= ' 42′orderby= ' orderid ' orderway= ' desc '}

.................

{/dede:arclist}

Weave Dream Set Column list sorting method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.