Joomla 2.5 隐藏分区



如果打开的 URL 不是基本 URL 或主页,我正在尝试隐藏模板中的div。现在,当用户打开链接时,div 应该是不可见的。我可以在 Joomla 2.5 中使用 php 检测并执行此操作吗?我该怎么做?

使用 javascript 试试这个:

if(window.location.href.indexOf("base url")>0){
    $('something').show();
}
else{
        $('something').hide();
}

演示小提琴:http://jsfiddle.net/surendraVsingh/ZHsH7/

请尝试以下操作。

if(JRequest::getVar('view') == "frontpage" && JRequest::getVar('option') == 'com_content) {    您正在查看主页!}

注意:即使您安装了名为 frontpage 的组件,这也不会中断

另一种选择

$app = JFactory::getApplication();$menu = $app->getMenu();if ($menu->getActive() == $menu->getDefault()) {    回声"这是头版";}

http://docs.joomla.org/How_to_determine_if_the_user_is_viewing_the_front_page

最新更新