Home >Backend Development >PHP Tutorial >The number of modified items in the top 10 rankings on the ecshop homepage
Second development of the downloaded template. I don’t know if it’s a bug in ecshop or if the template has been modified. The backend cannot set the number of top 10 items to display and only displays 5 pieces of data.
After some Baidu, to no avail, I started looking at the calling template librarytop10_goods.lbi, and there was no statement to control the number of displayed items.
I have learned about the template mechanism before. The template call array data is preset in index.php. Found on line 127: $smarty->assign('top_goods', get_top10()); // Sales ranking
Okay, now it is confirmed that it is the function get_top10();
But ctrl+F is not found in index.php. Well, I don’t know how it came about. Use editplus to find the function statement directly in the file. includeslib_goods.php
The target function was found at line 164 in includeslib_goods.php. OK, it is very close to the target.
Hmm? It seems to be a global variable. I searched again and found the place where the global variable is set: lib_common.php
Uh! ! Why is it 10, but the front desk can only call 5 pieces of data? I still don’t understand it. Maybe the author of the original template has made changes somewhere.
No choice but to return to includeslib_goods.php
Directly modify the number of control items in the SQL statement:
Refresh in the front desk, okay, it works.
I have always done front-end and rarely do PHP development. It is my first time to use ecshop for secondary development. Let’s use it first. O(∩_∩)O haha~
The above introduces the number of modifications to the top 10 rankings on the ecshop homepage, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.