Home  >  Article  >  Backend Development  >  dede Single table model dynamic browsing settings arclistsg arc.sglistview.class.php_PHP tutorial

dede Single table model dynamic browsing settings arclistsg arc.sglistview.class.php_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:17:20941browse

For example, classified information and content pages are generated statically by default. If you need to set them to dynamic access, you can refer to the following method:

Arclistsg tag, document list call tag for single table independent model

Method 1:


When using the arclist tag, there is a field ismake field in the corresponding main table dede_archives. You should know its function. It is dynamic when the value is -1. Our method is to imitate this.

When creating a single table model, there is no ismake field by default, because we manually create an ismake field and set its value to -1.

Note: When creating a model, you can add an ismake field. If not, you can add it directly to the corresponding table and add the ismake field to the listfields in the dede_channeltype table. This is to add a query field. If you have completed the last step and find that it does not work, you can check whether listfields has ismake

Modify the source code:

First, in arclistsg source code, at about line 264, find $row['arcurl'], GetFileUrl() [this function is in helpers/channelunit.helper.php], which is used to obtain the url address, among which There is an ismake parameter. If you are interested, you can take a look at this function.

Our purpose is to change the 1 after 1[$row['title'] in the GetFileUrl() parameter to $row['ismake']

Note: If you only need the arclistsg tag to display dynamics, this step is enough

Second, modify arc.sglistview.class.php, about line 760, comment out $row['ismake'] = 1;, and add the following lines, there is $row['arcurl'] = GetFileUrl () has the same code as in the first step, just change it to the same one as in the first step

At this point, dynamic browsing can basically be realized, but when adding or modifying, html files will still be generated. Just comment on the code that will generate html when the corresponding publishing program or modifying program is enough.

Method 2:

In fact, it is the same as method one. If you don’t want to create an ismake field, just change the corresponding local method to -1. However, the compatibility is not very good. Method one is recommended

   

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/626612.htmlTechArticleFor example, classification information and content pages are generated statically by default. If you need to set it to dynamic access, you can Refer to the following method: arclistsg tag, document list of single-table independent model...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn