如何在smarty中添加外部页面

时间:2015-02-25 06:15:11

标签: php smarty

我需要在smarty中添加一个报告页面。我需要创建一个外部页面来获取报告。如何在外部页面中获得智能预定义变量,数据库配置文件和类文件。任何人都可以提前帮助,谢谢。

1 个答案:

答案 0 :(得分:0)

您需要通过

为外部说somefile.php文件添加smarty类
include('Smarty.class.php');
$smarty = new Smarty;
// your declarations here
//your db connection and get your predefined variable using include
$smarty->display('somefile.tpl');

somefile.tpl文件中,您将通过{$declared variable}

获取该文件

因此,无论何时运行somefile.php文件,您都可以获取其中的值。