打开一个php的首页出现 Failed to load the theme frame and / or home file 怎么回事呢。

z4b 2007-05-20 12:59:14
出现怪异的错误。
就是下面的错误。
http://www.phpizabi.net/index.php?L=support.kbarticle&id=1357

http://forum.ceviz.net/sitemap/t-39107.html

没看懂,怎么回事呢。帮我看看,多谢了。
...全文
3170 点赞 收藏 9
写回复
9 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
zkl1983 2007-05-22
没问题了吗!
回复
z4b 2007-05-22
if (is_file("theme/".$GLOBALS["THEME"]."/".$CONF["FRAME_THEME_FILE"])) {
/*
The THEME file is loaded into the template conversion
system and procesed. The following will create the new
template object and push the theme file content into
its buffer
*/
$tpl = new template;
$tpl -> LoadThis(file_get_contents("theme/".$GLOBALS["THEME"]."/".$CONF["FRAME_THEME_FILE"]));
}

/*
There has been an error trying to load the theme file... Throw it.
*/
else {
return "Failed to load the theme frame and / or home file!";
}

要进入theme\default\frame.tpl 判断这个文件在不在,文件明明在,可是判断就是走不进正确的分支,走进了return "Failed to load the theme frame and / or home file!"; 错误分支.怎么回事呢?
回复
iasky 2007-05-21
这些错误提示是程序提示的巴,看代码
回复
z4b 2007-05-20
ob_start("theme_ob_callback"); 调用的函数出错,怎么调试? 多谢。
回复
z4b 2007-05-20
function theme_ob_callback($buffer) {
global $CONF;

/*
Some web servers (e.g. Apache) change the working directory of a script
when calling the callback function. Removing the following on those
servers will change the global path thus prevent PHPizabi from getting
the theme file thus producing an error output. The following function
will change the working directory back to its original value.
*/
if (!ckbool($CONF["IIS_COMPATIBILITY_MODE"]))
@chdir(@dirname((strstr($_SERVER["SCRIPT_FILENAME"], $_SERVER["PHP_SELF"])
? $_SERVER["SCRIPT_FILENAME"]
: $_SERVER["PATH_TRANSLATED"]
)));

/*
in WAP mode, no theme is required, each template constitutes
the theme AND the template content. We will just flush the
buffer to our WAP client.
*/
if ($GLOBALS["WAP_MODE"]) return $buffer;

/*
Handle the chromeless & WAP calls
*/
if ($GLOBALS["CHROMELESS_MODE"]) {
$tpl = new template;
$tpl -> LoadThis($buffer);
}

else {
/*
Handle unshared frame file for home
*/
if (!$CONF["SHARE_FRAME_FILE_WITH_HOME"] && (!isset($_GET["L"]) or $_GET["L"] == "" or $_GET["L"] == "HOME")) {
$tpl = new template;
$tpl -> LoadThis($buffer);
}

else {

/*
Check if the file exists
*/
if (is_file("theme/".$GLOBALS["THEME"]."/".$CONF["FRAME_THEME_FILE"])) {

/*
The THEME file is loaded into the template conversion
system and procesed. The following will create the new
template object and push the theme file content into
its buffer
*/
$tpl = new template;
$tpl -> LoadThis(file_get_contents("theme/".$GLOBALS["THEME"]."/".$CONF["FRAME_THEME_FILE"]));
}

/*
There has been an error trying to load the theme file... Throw it.
*/
else return "Failed to load the theme frame and / or home file!";
}
}

/*
We will now assign the generic theme-related replacement
items, the JUMP call and the ThemePath values are passed
with the next line.
*/
$tpl->AssignArray(array(
"jump"=>$buffer,
"themePath"=>"theme/{$GLOBALS["THEME"]}",
"systemVersion"=>$GLOBALS["SYSTEM_VERSION"],
"siteName"=>$CONF["SITE_NAME"],
"siteURL"=>"http://".$_SERVER['HTTP_HOST'].str_replace("/index.php", NULL, $_SERVER['PHP_SELF'])
));

/*
Include the theme-based bufferProcParse function file if
it exists, and run it on the buffer.
*/
if (is_file("theme/{$GLOBALS["THEME"]}/proc.inc.php") && include("theme/{$GLOBALS["THEME"]}/proc.inc.php")) {
if (function_exists("bufferProcParse")) $buffer_flush_value = bufferProcParse($tpl->Flush(1));
}
if (!isset($buffer_flush_value)) $buffer_flush_value = $tpl->Flush(1);

/*
The following is the output compression and cleanup
process. It will at first clean unnecessary codes
from the output, then gunzip the buffer.
*/
if (!$GLOBALS["CHROMELESS_MODE"]) {

if (ckbool($CONF["POST_PROCESS_CLEAN_OUTPUT"])) {
$characters_entities = array('/\\r/', '/\\n/', '/\\t/', ' {2,}+/');
$replacement_values = array('', '', '', ' ');
$buffer_flush_value = preg_replace($characters_entities, $replacement_values, $buffer_flush_value);
}

if (ckbool($CONF["POST_PROCESS_COMPRESS_OUTPUT"]) and strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
header("Content-Encoding: gzip");
$buffer_flush_value = gzencode(
$buffer_flush_value."<!-- Powered by {$GLOBALS["SYSTEM_VERSION"]} - http://www.PHPizabi.net -->",
$CONF["POST_PROCESS_COMPRESSION_RATE"]
);
}
else $buffer_flush_value .= "<!-- Powered by {$GLOBALS["SYSTEM_VERSION"]} - http://www.PHPizabi.net -->";
}

/*
The template buffer is flushed and passed back to
the OB system.
*/
return (!is_null($buffer_flush_value)?$buffer_flush_value:false);

}
回复
z4b 2007-05-20

执行 ob_start("theme_ob_callback");
打印的 Failed to load the theme frame and / or home file

theme_ob_callback 函数原形
function theme_ob_callback($buffer) {
global $CONF;

/*
Some web servers (e.g. Apache) change the working directory of a script
when calling the callback function. Removing the following on those
servers will change the global path thus prevent PHPizabi from getting
the theme file thus producing an error output. The following function
will change the working directory back to its original value.
*/
if (!ckbool($CONF["IIS_COMPATIBILITY_MODE"]))
@chdir(@dirname((strstr($_SERVER["SCRIPT_FILENAME"], $_SERVER["PHP_SELF"])
? $_SERVER["SCRIPT_FILENAME"]
: $_SERVER["PATH_TRANSLATED"]
)));

/*
in WAP mode, no theme is required, each template constitutes
the theme AND the template content. We will just flush the
buffer to our WAP client.
*/
if ($GLOBALS["WAP_MODE"]) return $buffer;

/*
Handle the chromeless & WAP calls
*/
echo "CHROMELESS_MODE" ;
if ($GLOBALS["CHROMELESS_MODE"]) {
$tpl = new template;
$tpl -> LoadThis($buffer);
}

else {
/*
Handle unshared frame file for home
*/
echo (!$CONF["SHARE_FRAME_FILE_WITH_HOME"] && (!isset($_GET["L"]) or $_GET["L"] == "" or $_GET["L"] == "HOME")) ;
if (!$CONF["SHARE_FRAME_FILE_WITH_HOME"] && (!isset($_GET["L"]) or $_GET["L"] == "" or $_GET["L"] == "HOME")) {
$tpl = new template;
$tpl -> LoadThis($buffer);
}

else {

/*
Check if the file exists
*/
echo "theme/".$GLOBALS["THEME"]."/".$CONF["FRAME_THEME_FILE"] ;
echo "AAAAAAAAAAAAAAA\n";
if (is_file("theme/".$GLOBALS["THEME"]."/".$CONF["FRAME_THEME_FILE"])) {

/*
The THEME file is loaded into the template conversion
system and procesed. The following will create the new
template object and push the theme file content into
its buffer
*/
$tpl = new template;
$tpl -> LoadThis(file_get_contents("theme/".$GLOBALS["THEME"]."/".$CONF["FRAME_THEME_FILE"]));
}

/*
There has been an error trying to load the theme file... Throw it.
*/
else return "Failed to load the theme frame and / or home file!";
}
}

/*
We will now assign the generic theme-related replacement
items, the JUMP call and the ThemePath values are passed
with the next line.
*/
$tpl->AssignArray(array(
"jump"=>$buffer,
"themePath"=>"theme/{$GLOBALS["THEME"]}",
"systemVersion"=>$GLOBALS["SYSTEM_VERSION"],
"siteName"=>$CONF["SITE_NAME"],
"siteURL"=>"http://".$_SERVER['HTTP_HOST'].str_replace("/index.php", NULL, $_SERVER['PHP_SELF'])
));

/*
Include the theme-based bufferProcParse function file if
it exists, and run it on the buffer.
*/
if (is_file("theme/{$GLOBALS["THEME"]}/proc.inc.php") && include("theme/{$GLOBALS["THEME"]}/proc.inc.php")) {
if (function_exists("bufferProcParse")) $buffer_flush_value = bufferProcParse($tpl->Flush(1));
}
if (!isset($buffer_flush_value)) $buffer_flush_value = $tpl->Flush(1);

/*
The following is the output compression and cleanup
process. It will at first clean unnecessary codes
from the output, then gunzip the buffer.
*/
if (!$GLOBALS["CHROMELESS_MODE"]) {

if (ckbool($CONF["POST_PROCESS_CLEAN_OUTPUT"])) {
$characters_entities = array('/\\r/', '/\\n/', '/\\t/', ' {2,}+/');
$replacement_values = array('', '', '', ' ');
$buffer_flush_value = preg_replace($characters_entities, $replacement_values, $buffer_flush_value);
}

if (ckbool($CONF["POST_PROCESS_COMPRESS_OUTPUT"]) and strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
header("Content-Encoding: gzip");
$buffer_flush_value = gzencode(
$buffer_flush_value."<!-- Powered by {$GLOBALS["SYSTEM_VERSION"]} - http://www.PHPizabi.net -->",
$CONF["POST_PROCESS_COMPRESSION_RATE"]
);
}
else $buffer_flush_value .= "<!-- Powered by {$GLOBALS["SYSTEM_VERSION"]} - http://www.PHPizabi.net -->";
}

/*
The template buffer is flushed and passed back to
the OB system.
*/
return (!is_null($buffer_flush_value)?$buffer_flush_value:false);

}
回复
kendo7 2007-05-20
zend studio /eclipse

都可以实现单步调试
回复
mrshelly 2007-05-20
代码问题. 仔细阅读代码提供者的文档..如果是商业代码,请同提供商联系解决..

如果要自己解决.需要做些单步调试.

你的出错提示应该是你的代码接管了错误管理..

读代码吧.
回复
z4b 2007-05-20
php 用什么工具单步调试, UltraEdit-32可以单步调试 PHP么?
回复
相关推荐
发帖
基础编程
创建于2007-09-28

2.1w+

社区成员

从PHP安装配置,PHP入门,PHP基础到PHP应用
申请成为版主
帖子事件
创建了帖子
2007-05-20 12:59
社区公告
暂无公告