Set category information filtering in dedecms

Source: Internet
Author: User
These days I am working on a secondary development of a logistics system, mainly in template design. Next we will introduce the background of this application: We have a new channel model, in which a field is the regional association form in dede ?? Nativeplace. If a customer comes in, a large amount of information will be found, and the customer is most concerned with the target information around him. Therefore, the second development of a logistics system over the past few days is mainly the template design. Next we will introduce the background of this application: We have a new channel model, in which a field is the regional association form in dede ?? Nativeplace. If a customer comes in, a large amount of information will be found, and the customer is most concerned with the target information around him. Therefore, you want to filter the classification information by Region selection.

Shows the effect. the following code is provided. First, add the following content to the corresponding List template to generate the filter options on top of the graph:
{Dede: infoguide} {/dede: infoguide}
Next I will only talk about the implementation of regional Filtering. please add others. Find/plus/list. php: $ t1 = ExecTime (); change to the above code
The key here is to define a $MysqlVariables are better than SQL statements used for filtering.
Next, find $ lv = new ListView ($ tid); change to $ lv = newListView ($ tid, $ mySql );.
Find include/arc. listview. class. php at: var $ remoteDir; and add: var $ mySql;
Change the following // php5 constructor to function _ construct ($ typeid, $ mySql, $ uppage = 1 );
Next, add a line after: global $ dsql, $ ftp;: $ this-> mySql = $ mySql;
  Next, there is an official comment in this file.: // In normal cases, first identify the ID from the arctiny table, and then query by ID (fast. There are two else. we want to change the query in the second else. That is, the first $ t2 = ExecTime (); Query in the previous else in the entire file. change the part after its where to wherearc. id in ($ idstr) $ mySql $ ordersql ";
So far, our classification information filtering can be used.
GET as $ k => $ v) {if ($ k = 'nativeplace') {$ mySql = $ mySql. and '. $ k. "= '". $ v. "'";}}
The key here is to define a $ mysql variable, which is better than organizing SQL statements for filtering.
Next, find $ lv = new ListView ($ tid); change to $ lv = newListView ($ tid, $ mySql );.
Find include/arc. listview. class. php at: var $ remoteDir; and add: var $ mySql;
Change the following // php5 constructor to function _ construct ($ typeid, $ mySql, $ uppage = 1 );
Next, add a line after: global $ dsql, $ ftp;: $ this-> mySql = $ mySql;
Next, there is an official note in this file: // in normal cases, first identify the ID from the arctiny table, and then query by ID (the speed is very fast) to find it here. There are two else. we want to change the query in the second else. That is, the first $ t2 = ExecTime (); Query in the previous else in the entire file. change the part after its where to wherearc. id in ($ idstr) $ mySql $ ordersql ";
So far, our classification information filtering can be used.

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.