zencart具体页面调用规则$body_code变量解析
zencart具体页面调用规则$body_code变量解析,可以修改中间产品方框的大小 2.2.5 、BODY文件在这个文件生效 require($body_code) includes/modules/pages/index/main_template_vars.php zencart具体页面调用:先看modules/pages/。下存不存在main_template_vars.php这个妖精文件有就 先迷惑调用这 不然就模版下templates/tpl_X_default.php 如果目录下存在 /public_html/includes/modules/pages/index/main_template_vars.php 就调用main_template_vars.php这文件 不存在的话就 /public_html/includes/templates/mytemplate/templates/tpl_index_default.php文件 如果目录下存在 /public_html/includes/modules/pages/faq/main_template_vars.php 就调用main_template_vars.php这文件 不存在的话就 /public_html/includes/templates/mytemplate/templates/tpl_faq_default.php文件 在文件\includes\templates\模板\common\tpl_main_page.php 文件里面有$body_code这样一个变量,他具体什么意思,可能很多人不知道.但是从他字面的意思,可以知道他大概什么意思.我们知道,zencart系统默认的页面结构是上 中(左中右), 下,而这个变量所处的位置就是左中右的中间部分,也就是夹在左右边框的中间. 这个变量其实是一个文件路径, require($body_code); 这样调用意思就是加载这个文件.而这个变量则来源,includes\templates\模板\common\main_template_vars.php 文件 (没有的话在默认模版下) if (file_exists(DIR_WS_MODULES . ‘pages/’ . $current_page_base . ‘/main_template_vars.php’)) { $body_code= DIR_WS_MODULES . ‘pages/’ . $current_page_base . ‘/main_template_vars.php’; } else { $body_code= $template->get_template_dir(‘tpl_’ . preg_replace(‘/.php/’, ”,$_GET[‘main_page’]) . ‘_default.php’,DIR_WS_TEMPLATE, $current_page_base,’templates’). ‘/tpl_’ . $_GET[‘main_page’] . …