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.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章