项目发现ECmobile的应用首页的特价区只显示1个商品和分类区只显示2个商品,需要按要求显示
于是查找了接口文件/Controller/Home/Data.php
发现代码 function gz_get_promote_goods($cats = ”)中的如下代码
/* 取得促销lbi的数量限制 */
$num = get_library_number(“recommend_promotion”);
那么recommend_promotion在哪设置的?
于是又去找函数位置get_library_number()在哪
发现在\includes\lib_main.php中
代码如下:
/** * 取得某模板某库设置的数量 * @param string $template 模板名,如index * @param string $library 库名,如recommend_best * @param int $def_num 默认数量:如果没有设置模板,显示的数量 * @return int 数量 */ function get_library_number( $library , $template = null) { global $page_libs ; if ( empty ( $template )) { $template = basename (PHP_SELF); $template = substr ( $template , 0, strrpos ( $template , '.' )); } $template = addslashes ( $template ); static $lib_list = array (); /* 如果没有该模板的信息,取得该模板的信息 */ if (!isset( $lib_list [ $template ])) { $lib_list [ $template ] = array (); $sql = "SELECT library, number FROM " . $GLOBALS [ 'ecs' ]->table( 'template' ) . " WHERE theme = '" . $GLOBALS ['_CFG '][' template '] . "' " . " AND filename = '$template' AND remarks='' " ; $res = $GLOBALS [ 'db' ]->query( $sql ); while ( $row = $GLOBALS [ 'db' ]->fetchRow( $res )) { $lib = basename ( strtolower ( substr ( $row [ 'library' ], 0, strpos ( $row [ 'library' ], '.' )))); $lib_list [ $template ][ $lib ] = $row [ 'number' ]; } } $num = 0; if (isset( $lib_list [ $template ][ $library ])) { $num = intval ( $lib_list [ $template ][ $library ]); } else { /* 模板设置文件查找默认值 */ include_once (ROOT_PATH . ADMIN_PATH . '/includes/lib_template.php' ); static $static_page_libs = null; if ( $static_page_libs == null) { $static_page_libs = $page_libs ; } $lib = '/library/' . $library . '.lbi' ; $num = isset( $static_page_libs [ $template ][ $lib ]) ? $static_page_libs [ $template ][ $lib ] : 3; } return $num ; } |
发现,它是在ecs_template中设置的,那么就简单了,就到数据库查询设置的显示数量,修改了即可了,开源没有文档真的很坑爹,