joomlaのホームページだけにメッセージを表示するにはどうすればよいですか? 私は、site.com/index.php/page や site.com 以外のものではなく、site.com に表示することに興味があります。
私は以下をテストしました:
<?php $app = JFactory::getApplication();
$menu = $app->getMenu();
$lang = JFactory::getLanguage();
if ($menu->getActive() == $menu->getDefault($lang->getTag())) : ?>this is the homepage
<?php endif; ?>
この
<?php $menu = & JSite::getMenu();
if ($menu->getActive() == $menu->getDefault()) {
echo "this is the homepage";
}
?>
問題は、明らかにホームページではないhttp://site.com/index.php/category/id/78-articleのようなページに「これはホームページです」というメッセージがまだ表示されることです。リンクに index.php があるときはいつでも、上記のコードはそれがホームページに属していると考えているようです。