Home > CMS Tutorial > Empire CMS > How to get the current list ID in Empire CMS

How to get the current list ID in Empire CMS

藏色散人
Release: 2019-12-06 09:08:52
Original
3087 people have browsed it

How to get the current list ID in Empire CMS

How does Empire CMS get the current list ID?

The example in this article describes how Imperial CMS obtains the current list ID in a custom list. Share it with everyone for your reference, the details are as follows:

Recommended to study "Empire cms Tutorial"

When I was doing a project with Empire CMS today, I found that in the Empire customization list Unable to get the ID of the current custom list. After analyzing the source code of Empire, we found that the default value sent by Empire is 0. Let's briefly record how to implement "Empire CMS custom list to obtain the current list ID" by modifying the source code

Introduction to the project functions mentioned above:

Users have created a large number of items using the custom list function Custom lists, and then in these custom lists, the names of custom lists of the same category must be obtained, and specific CSS styles must be added to the style of the current column name.

Custom list template code snippet

The code is as follows:

[e:loop={'select listid,listname,filepath from [!db.pre!]enewsuserlist where classid=1',100,24}]
<li<?=($bqr[listid]==$GLOBALS[navclassid]?&#39; class="this"&#39;:&#39;&#39;)?>><?=$bqr[listname]?></li>
[/e:loop]
Copy after login

By default, the value of $GLOBALS[navclassid] is empty, so we only need to modify the program Assign the ID value of the current custom list to $GLOBALS[navclassid]

Empire source program modification

By analyzing the program running process with the phpxref tool, it is found that the function that generates the custom information list is ReUserlist(), ReUserlist() further calls the ListHtml() function to generate an information list, and passes in the $enews event as 4. At this point, the list ID can be passed in through the ListHtml() function.

Open (/e/class/functions.php) and find the function ListHtml (you can search function ListHtml for quick search) and find the following code

The code is as follows:

$GLOBALS[&#39;navclassid&#39;]=$classid;
Copy after login

Change to

The code is as follows:

$GLOBALS[&#39;navclassid&#39;]=$enews==4?$userlistr[&#39;listid&#39;]:$classid;
Copy after login

Save (note the file encoding issue)

Regenerate the custom list, the required functions have been implemented!

I hope this article will be helpful to everyone’s website programming based on Imperial CMS.

The above is the detailed content of How to get the current list ID in Empire CMS. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template