【问题标题】:Error Smarty - Fatal error: Uncaught exception错误 Smarty - 致命错误:未捕获的异常
【发布时间】:2011-06-04 04:09:13
【问题描述】:

致命错误:未捕获异常 'SmartyCompilerException' 并在第 9 行“Ola! {$names}, bem vindo ao聪明!” C:\xampp\htdocs\eventos\libs\sysplugins\smarty_internal_templatecompilerbase.php:441 中的未知标签“private_print_expression”' 堆栈跟踪:#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...' , 数组, 数组) #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 在第 441 行

我的 php 代码

<?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');
?>

还有我的智能代码 (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>

【问题讨论】:

    标签: php html smarty


    【解决方案1】:

    改变

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

    到

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

    【讨论】:

    • 你使用什么 smarty 版本?和其他信息?与 prestashop 一起使用?还是?
    猜你喜欢
    • 2014-08-26
    • 2013-07-07
    • 2015-06-10
    • 2015-06-20
    • 2014-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多