从smarty中的include_php分配数据

时间:2018-07-25 17:48:44

标签: php smarty

在Smarty模板中从模板中包含的PHP文件分配数据时,我遇到了麻烦。我正在使用最新版本的smartyBC。这是代码:

index.php:

require_once 'include/ui.class.php';

$ui = new ui;

$data = $ui->smarty->assign('title',"INDEX WEB PAGE");

index.tpl:

{include_php 'index.php'}
{$title}

它无法识别$ title并返回此消息通知:未定义索引:$ title

0 个答案:

没有答案