菜鸟级的php和msarty的问题
来源:百度知道 编辑:UC知道 时间:2024/09/22 16:49:53
我的程序运行出来是显示的标签 {$hello} ,正常的应该显示 Hello World!
不知道怎么回事,求高手解答下,
代码如下:
index.tpl
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
<title>Smarty</title>
</head>
<body>
{$hello}
</body>
</html>
index.php页面代码
<?php
//引用类文件
require 'smarty/libs/Smarty.class.php';
$smarty = new Smarty;
//设置各个目录的路径,这里是安装的重点
$smarty->template_dir = 'smarty/templates'; //模版存放目录
$smarty->compile_dir = 'smarty/templates_c'; //编译目录
$smarty->config_dir = 'smarty/config';
$smarty->cache_dir =
不知道怎么回事,求高手解答下,
代码如下:
index.tpl
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
<title>Smarty</title>
</head>
<body>
{$hello}
</body>
</html>
index.php页面代码
<?php
//引用类文件
require 'smarty/libs/Smarty.class.php';
$smarty = new Smarty;
//设置各个目录的路径,这里是安装的重点
$smarty->template_dir = 'smarty/templates'; //模版存放目录
$smarty->compile_dir = 'smarty/templates_c'; //编译目录
$smarty->config_dir = 'smarty/config';
$smarty->cache_dir =
你的页面搞的有点混乱啊,给你正解
index.php的代码:
<?php
include("smarty_inc.php");
$var = 'Hello World!';
$smarty->assign("name", $var);
$smarty->display("index.html");
?>
smarty_inc.php的代码
<?php
include_once("smarty/Smarty.class.php");
$smarty = new Smarty();
$smarty->config_dir="smarty/Config_File.class.php"; $smarty->caching=false;
$smarty->template_dir = "./templates";
$smarty->compile_dir = "./templates_c";
$smarty->cache_dir = "./smarty_cache";
$smarty->left_delimiter = "<!--";
$smarty->right_delimiter = "-->";
?>
index.html的代码
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
<title>Smarty</title> <