修改一下上一篇中的控制php文件,增加一个变量并赋值,然后在模板文件中显示这个变量值。
控制文件 /source/module/gycp/gycp_publish.php:
<?php
// mod文件只能被入口文件引用,不能直接访问
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$testvar = 'this is test string!';
//显示发布表单
include_once template("gycp/gycp_publish");
?>
<!--//说明: 显示公共头部模板-->
<!--{template common/header}-->
<br/>
<br/>
<br/>
<br/>
aaa
<br/>
{$testvar}
<br/>
<br/>
<br/>
<!--//说明: 显示公共尾部模板-->
<!--{template common/footer}-->
显示结果: