【发布时间】:2013-03-07 21:16:38
【问题描述】:
我怎样才能只在joomla的主页上显示一条消息? 我有兴趣在 site.com 上显示它,而不是在 site.com/index.php/page 或其他任何网站上。
我已经测试了以下内容:
<?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,上面的代码就认为它属于首页。
【问题讨论】:
-
您使用的 joomla 版本是什么?
-
您可以更好地了解如何查看主页docs.joomla.org/…