如何僅在joomla的主頁上顯示消息? 我有興趣在site.com上展示它,而不是在site.com/index.php/page或其他任何網站上展示它。如何僅在joomla主頁上顯示消息?
我已經測試了以下內容:
<?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頁,明確ISN」在主頁上。似乎只要鏈接中有index.php,上面的代碼就認爲它屬於主頁。
什麼是您使用的joomla版本? – HamZa 2013-03-07 21:19:42
Joomla 3.0 !!!!! – 10now 2013-03-07 21:20:42
你可以更好的瞭解如何檢查主頁http://docs.joomla.org/How_to_determine_if_the_user_is_viewing_the_front_page – 2013-03-07 21:24:33