【发布时间】:2013-08-08 03:51:51
【问题描述】:
我正在 joomla 中创建一个简单的模块。我有一个文件 mod_progress.php。
defined( '_JEXEC' ) or die( 'Restricted access' );
// Include the syndicate functions only once
require_once( dirname(__FILE__).'/helper.php' );
require( JModuleHelper::getLayoutPath( 'mod_progress' ) );
$document = JFactory::getDocument();
$document->addStyleSheet(JURI::base() . 'modules/mod_progress/tmpl/styles.css');
$percentValues = htmlspecialchars($params->get('percentValues'));
最后一行是这里感兴趣的内容。我想获取变量 $percentValues 并将其传递给模块的 default.php 模板。
在我的 default.php 中,我只有:
<?php echo $percentValues; ?>
这不起作用。我得到的错误告诉我变量未定义。
但是,如果我这样做:
<?php $percentValues = htmlspecialchars($params->get('percentValues'));
echo $percentValues; ?>
它工作得很好。有人可以解释为什么我不能使用这个变量吗?我一定有什么大不了的。使用 Joomla! 3.1.
提前谢谢你。
贾里德
【问题讨论】: