Home > Article > CMS Tutorial > 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]?' class="this"':'')?>><?=$bqr[listname]?></li> [/e:loop]
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['navclassid']=$classid;
Change to
The code is as follows:
$GLOBALS['navclassid']=$enews==4?$userlistr['listid']:$classid;
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!