Notice: Undefined index: jsbtmfiles in /common.inc.php on line 170
/*
出现上面的错误,测试如下
在这个方法中打印输出有,但是还是会出现smarty 不能编译(/tmp/template_c/ 权限是最高的)生成%%45^45E^45E48.index.tpl.php的文件,但我在本机的windows环境下,是可以生成的,这个是什么问题造成的,大家给点建议
环境是centos下nginx+php ,这个是开源的安乐业房产加补丁了!出现这样的问题很奇怪!
public function getJsHtml($btm=NULL) {
$html = '';
if (!$GLOBALS['cfg']['page']['jsfiles']) {
return;
}
$jsFile = $btm?'jsbtmfiles':'jsfiles'; //ndefined index: jsbtmfiles in 这个问题不影响吧,jsbtmfiles//这个没有定义,晕,不懂在哪定义的,这里echo $jsFile 值为jsfiles
echo '<pre>';
var_dump($GLOBALS['cfg']['page'][$jsFile]);
array(5) {
["http://***/common/js/jquery-1.2.6.min.js"]=>
string(54) "http://***/common/js/jquery-1.2.6.min.js"
["http://***/common/js/thickbox.js"]=>
string(46) "http://***/common/js/thickbox.js"
["http://***/common/js/Autocompleter/lib/jquery.bgiframe.min.js"]=>
string(75) "http://***/common/js/Autocompleter/lib/jquery.bgiframe.min.js"
["http://***/common/js/Autocompleter/lib/ajaxQueue.js"]=>
string(65) "http://***/common/js/Autocompleter/lib/ajaxQueue.js"
["http://***/common/js/Autocompleter/jquery.autocomplete.js"]=>
string(71) "http://***/common/js/Autocompleter/jquery.autocomplete.js"
}
*/
http://***/common/js/jquery-1.2.6.min.jshttp://***/common/js/thickbox.jshttp://***/common/js/Autocompleter/lib/jquery.bgiframe.min.jshttp://***/common/js/Autocompleter/lib/ajaxQueue.jshttp://***/common/js/Autocompleter/jquery.autocomplete.js
Warning: include(/data/website/www.dnkb.com.cn/house.dnkb/tmp/template_c//%%45^45E^45E480CD%%index.tpl.php) [function.include]: failed to open stream: No such file or directory in /data/website/www.dnkb.com.cn/house.dnkb/common/lib/smarty/libs/Smarty.class.php on line 1258Warning: include() [function.include]: Failed opening '/data/website/www.dnkb.com.cn/house.dnkb/tmp/template_c//%%45^45E^45E480CD%%index.tpl.php' for inclusion (include_path='.:/data/sys/php-cgi/lib/php') in /data/website/www.dnkb.com.cn/house.dnkb/common/lib/smarty/libs/Smarty.class.php on line 1258
/*
出现上面的错误,测试如下
在这个方法中打印输出有,但是还是会出现smarty 不能编译(/tmp/template_c/ 权限是最高的)生成%%45^45E^45E48.index.tpl.php的文件,但我在本机的windows环境下,是可以生成的,这个是什么问题造成的,大家给点建议
环境是centos下nginx+php ,这个是开源的安乐业房产加补丁了!出现这样的问题很奇怪!
public function getJsHtml($btm=NULL) {
$html = '';
if (!$GLOBALS['cfg']['page']['jsfiles']) {
return;
}
$jsFile = $btm?'jsbtmfiles':'jsfiles'; //ndefined index: jsbtmfiles in 这个问题不影响吧,jsbtmfiles//这个没有定义,晕,不懂在哪定义的,这里echo $jsFile 值为jsfiles
echo '<pre>';
var_dump($GLOBALS['cfg']['page'][$jsFile]);
array(5) {
["http://***/common/js/jquery-1.2.6.min.js"]=>
string(54) "http://***/common/js/jquery-1.2.6.min.js"
["http://***/common/js/thickbox.js"]=>
string(46) "http://***/common/js/thickbox.js"
["http://***/common/js/Autocompleter/lib/jquery.bgiframe.min.js"]=>
string(75) "http://***/common/js/Autocompleter/lib/jquery.bgiframe.min.js"
["http://***/common/js/Autocompleter/lib/ajaxQueue.js"]=>
string(65) "http://***/common/js/Autocompleter/lib/ajaxQueue.js"
["http://***/common/js/Autocompleter/jquery.autocomplete.js"]=>
string(71) "http://***/common/js/Autocompleter/jquery.autocomplete.js"
}
*/
http://***/common/js/jquery-1.2.6.min.jshttp://***/common/js/thickbox.jshttp://***/common/js/Autocompleter/lib/jquery.bgiframe.min.jshttp://***/common/js/Autocompleter/lib/ajaxQueue.jshttp://***/common/js/Autocompleter/jquery.autocomplete.js
Warning: include(/data/website/www.dnkb.com.cn/house.dnkb/tmp/template_c//%%45^45E^45E480CD%%index.tpl.php) [function.include]: failed to open stream: No such file or directory in /data/website/www.dnkb.com.cn/house.dnkb/common/lib/smarty/libs/Smarty.class.php on line 1258Warning: include() [function.include]: Failed opening '/data/website/www.dnkb.com.cn/house.dnkb/tmp/template_c//%%45^45E^45E480CD%%index.tpl.php' for inclusion (include_path='.:/data/sys/php-cgi/lib/php') in /data/website/www.dnkb.com.cn/house.dnkb/common/lib/smarty/libs/Smarty.class.php on line 1258
没有发现(定义)的变量index,也就是没有$inde这个变量或者数组中不存在下标是index的,至于为什么在windows上没事,估计是环境中报错级别的等级设置不一样
在windows下测试也正常传到linux服务器上,出现如下错误,现在可以确定是之前是因为smarty编译的问题,有遇到的朋友,或者知道的朋友指导下啊,不胜感激
object(Smarty)#1 (65) {
["auto_literal"]=>
bool(true)
["error_unassigned"]=>
bool(false)
["template_dir"]=>
string(11) "./templates"
["default_template_handler_func"]=>
NULL
["compile_dir"]=>
string(13) "./templates_c"
["plugins_dir"]=>
array(1) {
[0]=>
string(62) "smartys/libs/plugins/"
}
["cache_dir"]=>
string(7) "./cache"
["config_dir"]=>
string(9) "./configs"
}Warning: rename() has been disabled for security reasons in /smartys/libs/sysplugins/smarty_internal_write_file.php on line 48
Warning: chmod() [function.chmod]: No such file or directory in /smartys/libs/sysplugins/smarty_internal_write_file.php on line 50
Warning: include(./templates_c/2319eb374ebfda6635cffe78ca7a13eed09695fd.file.test.tpl.php) [function.include]: failed to open stream: No such file or directory in smartys/libs/sysplugins/smarty_internal_template.php on line 432
Warning: include() [function.include]: Failed opening './templates_c/2319eb374ebfda6635cffe78ca7a13eed09695fd.file.test.tpl.php' for inclusion (include_path='.:/data/sys/php-cgi/lib/php') in /smartys/libs/sysplugins/smarty_internal_template.php on line 432
错误应该出现在这里
if (!$GLOBALS['cfg']['page']['jsfiles']) {
健壮的写法应该是
if (! isset($GLOBALS['cfg']['page']['jsfiles']) ) {2、上传系统时,请不要上传 template_c 目录中的内容
同时用上传工具清除掉 template_c 目录中的全部内容
<!--{foreach from=$house_price_option item=item key=key }--> //
city_selecter2.tpl 中前面也有这样的,也smarty也可以解析的
到!!挺奇怪的
//city_selecter2.tpl 部分代码
<li class="filterTarget">区域:</li>
<li <!--{if $smarty.get.cityarea==''}-->class="linkOn" <!--{/if}-->><a href="index.php?price=<!--{$smarty.get.price}-->&totalarea=<!--{$smarty.get.totalarea}-->&room=<!--{$smarty.get.room}-->&type=<!--{$smarty.get.type}-->&feature=<!--{$smarty.get.feature}-->&switch=<!--{$smarty.get.switch}-->&showstyle=<!--{$smarty.get.showstyle}-->&list_num=<!--{$smarty.get.list_num}-->&house_age=<!--{$smarty.get.house_age}-->&house_floor=<!--{$smarty.get.house_floor}-->&company=<!--{$smarty.get.company}-->&q=<!--{$smarty.get.q}-->&list_order=<!--{$smarty.get.list_order}-->">不限</a></li>
<!--{foreach from=$cityarea_option item=item key=key }-->
<li class="<!--{if $key==$smarty.get.cityarea}-->linkOn<!--{/if}-->"><a href="index.php?cityarea=<!--{$key}-->&borough=&price=<!--{$smarty.get.price}-->&totalarea=<!--{$smarty.get.totalarea}-->&room=<!--{$smarty.get.room}-->&type=<!--{$smarty.get.type}-->&feature=<!--{$smarty.get.feature}-->&switch=<!--{$smarty.get.switch}-->&showstyle=<!--{$smarty.get.showstyle}-->&list_num=<!--{$smarty.get.list_num}-->&house_age=<!--{$smarty.get.house_age}-->&house_floor=<!--{$smarty.get.house_floor}-->&company=<!--{$smarty.get.company}-->&q=<!--{$smarty.get.q}-->&list_order=<!--{$smarty.get.list_order}-->" ><!--{$item}--></a></li>
<!--{/foreach}--></ul></div><ul>
<li class="filterTarget">价格:</li>
<li <!--{if $smarty.get.price==''}-->class="linkOn" <!--{/if}-->><a href="index.php?cityarea=<!--{$smarty.get.cityarea}-->&borough=<!--{$smarty.get.borough}-->&price=&totalarea=<!--{$smarty.get.totalarea}-->&room=<!--{$smarty.get.room}-->&type=<!--{$smarty.get.type}-->&feature=<!--{$smarty.get.feature}-->&switch=<!--{$smarty.get.switch}-->&showstyle=<!--{$smarty.get.showstyle}-->&list_num=<!--{$smarty.get.list_num}-->&house_age=<!--{$smarty.get.house_age}-->&house_floor=<!--{$smarty.get.house_floor}-->&company=<!--{$smarty.get.company}-->&q=<!--{$smarty.get.q}-->&list_order=<!--{$smarty.get.list_order}-->">不限</a></li>
<!--{foreach from=$house_price_option item=item key=key }--> <li class="<!--{if $key==$smarty.get.price}-->linkOn<!--{/if}-->"><a href="index.php?cityarea=<!--{$smarty.get.cityarea}-->&borough=<!--{$smarty.get.borough}-->&price=<!--{$key}-->&totalarea=<!--{$smarty.get.totalarea}-->&room=<!--{$smarty.get.room}-->&type=<!--{$smarty.get.type}-->&feature=<!--{$smarty.get.feature}-->&switch=<!--{$smarty.get.switch}-->&showstyle=<!--{$smarty.get.showstyle}-->&list_num=<!--{$smarty.get.list_num}-->&house_age=<!--{$smarty.get.house_age}-->&house_floor=<!--{$smarty.get.house_floor}-->&company=<!--{$smarty.get.company}-->&q=<!--{$smarty.get.q}-->&list_order=<!--{$smarty.get.list_order}-->"><!--{$item}--></a></li>
<!--{/foreach}-->
</ul>//错误提示,希望大家给点提示Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/themes/2010a/template/inc/city_selecter2.tpl" on line 64 "<!--{foreach from=$house_price_option item=item key=key }-->" - Unexpected " }-->", expected one of: "}-->" , " "' in /common/lib/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php:431 Stack trace: #0 /common/lib/smarty/libs/sysplugins/smarty_internal_templateparser.php(2855): Smarty_Internal_TemplateCompilerBase->trigger_template_error() #1 /common/lib/smarty/libs/sysplugins/smarty_internal_templateparser.php(2920): Smarty_Internal_Templateparser->yy_syntax_error(10, ' }-->') #2 /common/lib/smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php(51): Smarty_Internal_Templateparser->doParse(10, ' }-->') #3 /data/website/www.dnkb.com.cn/house in /common/lib/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php on line 431