phpcms原始碼跟蹤(1)

2021-09-08 18:36:39 字數 2481 閱讀 3387

本次跟蹤解決幾個問題:

1、快取檔案從**來,過程中被刪除了怎麼辦

2、模板html是如何被引入的

進入首頁時,通過最初的呼叫,進入控制器\phpcms\modules\content\index.php::init()中

public

function init() else

$siteid = $globals['siteid'] = max($siteid,1);
define('siteid', $siteid);
$_userid = $this->_userid;
$_username = $this->_username;
$_groupid = $this->_groupid;
//seo 搜尋引擎優化資訊
$seo = seo($siteid);//seo 搜尋引擎優化資訊
$sitelist  = getcache('sitelist','commons');//快取後台設定的所有站點配置資訊
$default_style = $sitelist[$siteid]['default_style'];//當前站點預設模板風格配置
$categorys = getcache('category_content_'.$siteid,'commons');//當前站點所有欄目詳細配置資訊
include template('content','index',$default_style);//呼叫第三步:模板呼叫
}

$siteid=1

$path.$classname=libs\classescache_factory

public function get()中
$filepath = cache_path.'caches_'.$module.'/caches_'.$type.'/'=c:\phpwork\bangth_com\src\caches\caches_commons/caches_data/

$filename=sitelist.cache.php
$filepath = cache_path.'caches_'.$module.'/caches_'.$type.'/'=c:\phpwork\bangth_com\src\caches\caches_commons/caches_data/
$filename=category_content_1.cache.php
通過
$data = @require($filepath.$filename);獲取快取中的資料
$categorys = getcache('category_content_'.$siteid,'commons');獲取到欄目資料
function template($module = 'content', $template = 'index', $style = 'default')中
$compiledtplfile = phpcms_path.'caches'.directory_separator.'caches_template'.directory_separator.$style.directory_separator.$module.directory_separator.$template.'.php'
=c:\phpwork\bangth_com\src\caches\caches_template\default\content\index.php
pc_path.'templates'.directory_separator.$style.directory_separator.$module.directory_separator.$template.'.html'
=c:\phpwork\bangth_com\src\phpcms\templates\default\content\index.html
public function template_compile('content', 'index', $style = 'default')完成根據模板編譯成php檔案的過程
$tplfile=c:\phpwork\bangth_com\src\phpcms\templates\default\content\index.html
nb的是通過
public function template_parse($str)
將html模板檔案轉化為php檔案
轉化完成後通過之前
public function init()函式中最後一行:include呼叫生成的\caches\caches_template\default\content\index.php

phpcms原始碼跟蹤(1)

本次跟蹤解決幾個問題 1 快取檔案從 來,過程中被刪除了怎麼辦 2 模板html是如何被引入的 進入首頁時,通過最初的呼叫,進入控制器 phpcms modules content index.php init 中 public function init else siteid globals s...

phpcms原始碼解析(2)

1 程式啟動邏輯 2 路由初始化 程式啟動之初有乙個路由初始化的過程 param pc base load sys class param returnself load class param path,initialize 目的只是為了載入 phpcms libs classes param.c...

phpcms 原始碼解析 模板引擎

phpcms 整站 分析講解 六 之模板引擎 發布 水水 19 may 函式 template函式是在global.func.php 裡面定義的。在前面的phpcms 的首頁 index.php 裡就見到了。用法 include template 用法很熟,呵呵其實和 dz 的模板引擎一樣的用法。但...