![]() |
zencart v150 主要函数解析整理
1.get_template_part($page_directory, $template_part, $file_extension = '.php'):
$page_directory是文件目录,$template_part是匹配的条件,执行的结果是包含该目录下所有文件名匹配这个条件的文件; 比如index.php文件中,$directory_array = $template->get_template_part($code_page_directory, ‘/^header_php/’); 指的是包含includes/modules/pages/..所有以header_php开头的php文件。 2.get_template_dir($template_code, $current_template, $current_page, $template_dir, $debug=false): 首先,按优先级依次检测以下三个目录中有没有匹配$template_code 的这个文件,如有返回该目录。 (1) $current_template / $current_page / (2) DIR_WS_TEMPLATES / template_default / $current_page / (3) $current_template / $template_dir / (4) 如以上三个目录都不存在,直接返回 DIR_WS_TEMPLATES / template_default / $template_dir / 然后,在返回的目录下查找$template_code文件。 比如index.php文件中,require($template->get_template_dir(’html_header.php’,DIR_WS_TEMPLATE, $current_page_base,’common’). ‘/html_header.php’); 假设当前url:http://localhost/zencart/index.php?main_page=product_info&cPath=48, 那么将会查找一下目录: (1) includes/templates/product_info/.. html_header.php (2) includes/templates/template_default/product_info/.. html_header.php (3) includes/templates/common/.. html_header.php (4) includes/templates/template_default/common/.. html_header.php (默认情况) |
| All times are GMT +8. The time now is 07:43 AM. |
Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.