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; ?>
それはうまく動作します。誰かが変数を使用できない理由を説明できますか?私が見逃している何か大きなものがあるに違いありません。ジュムラを使って!3.1.
前もって感謝します。
ジャレド