晕死了,我的test.php和template.html文件分别是 test.php ------------------------------------------------------------- <?php include ('class.smarttemplate.php'); $template->display("var/www/html/template_dir/template.html"); $text = 'Sample Text'; $template->assign( 'IP', $text ); $template->output(); ?> --------------------------------------------------------------------template文件是: -------------------------------------------------------------------- <html><body><input name="IP" type="text" id="{$IP}"></body></html> -------------------------------------------------------------------- 浏览器输出是: Fatal error: Call to a member function on a non-object in /var/www/html/test3.php on line 3 请大家看看是哪里出了问题阿??
<td colspan="3"><input name="IP" type="text" id="IP" value="{$IP}">
Call to a member function on a non-object in /var/www/html/test.php
好像跟本就没有建立实例...
$template->display("var/www/html/template_dir/template.html");并放在最后
test.php
-------------------------------------------------------------
<?php
include ('class.smarttemplate.php');
$template->display("var/www/html/template_dir/template.html"); $text = 'Sample Text';
$template->assign( 'IP', $text ); $template->output();
?>
--------------------------------------------------------------------template文件是:
--------------------------------------------------------------------
<html><body><input name="IP" type="text" id="{$IP}"></body></html>
--------------------------------------------------------------------
浏览器输出是:
Fatal error: Call to a member function on a non-object in /var/www/html/test3.php on line 3
请大家看看是哪里出了问题阿??
include ('class.smarttemplate.php'); $text = 'Sample Text';
$template->assign( 'IP', $text ); $template->display("var/www/html/template_dir/template.html");
?>
<?php
include ('class.smarttemplate.php'); $text = 'Sample Text'; $template=new Smarty();
$template->assign( 'IP', $text ); $template->display("var/www/html/template_dir/template.html");
?>
而且楼上的楼上的那个定义,居然用 $template=new Smarty();?这是smarttemplate啊!
<?php require_once "class.smarttemplate.php";
$template= new SmartTemplate("var/www/html/template_dir/template.html");
$text = 'Sample Text';
$template->assign( 'IP', $text );
$template->output();?><html><body><input name="IP" type="text" id="IP" value="{IP}"></body></html>