doulue7522 2011-06-04 04:09
浏览 230

错误Smarty - 致命错误:未捕获的异常

Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "C:\xampp\htdocs\eventos\libs\templates\teste.tpl" on line 9 "Ola! {$names}, bem vindo ao Smarty!" unknown tag "private_print_expression"' in C:\xampp\htdocs\eventos\libs\sysplugins\smarty_internal_templatecompilerbase.php:441 Stack trace: #0 C:\xampp\htdocs\eventos\libs\sysplugins\smarty_internal_templatecompilerbase.php(263): Smarty_Internal_TemplateCompilerBase->trigger_template_error('unknown tag "pr...', 9) #1 C:\xampp\htdocs\eventos\libs\sysplugins\smarty_internal_templateparser.php(2338): Smarty_Internal_TemplateCompilerBase->compileTag('private_print_e...', Array, Array) #2 C:\xampp\htdocs\eventos\libs\sysplugins\smarty_internal_templateparser.php(2846): Smarty_Internal_Templateparser->yy_r28() #3 C:\xampp\htdocs\eventos\libs\sysplugins\smarty_internal_templateparser.php(2946): Smarty_Internal_Templateparser->yy_reduce(30) #4 C:\xampp\htdocs\eventos\libs\sysplugins\smarty_internal_smartytemplatecompiler.php(51): Smart in C:\xampp\htdocs\eventos\libs\sysplugins\smarty_internal_templatecompilerbase.php on line 441

my php code

<?php
include('includes/header.html');
include('conf/conf.php');
require_once(SMARTY_DIR.'Smarty.class.php');
$smarty = new Smarty();

$smarty->template_dir = 'C:\xampp\htdocs\eventos\libs\templates';
$smarty->compile_dir = 'C:\xampp\htdocs\eventos\libs\templates_c';
$smarty->config_dir = 'C:\xampp\htdocs\eventos\libs\configs';
$smarty->cache_dir = 'C:\xampp\htdocs\eventos\libs\cache';

$smarty->assign('name','Ned');

$smarty->display('teste.tpl');
?>

and my smart code (teste.tpl)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
Ola! {$name}, bem vindo ao Smarty!
</body>
</html>
  • 写回答

1条回答 默认 最新

  • dtio35880438 2011-06-04 04:10
    关注

    change

    $smarty->assign('name','Ned');
    

    to

    $smarty->assign('names','Ned');
    
    评论

报告相同问题?

悬赏问题

  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示