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   (默认情况)

3.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值