0

这是我的 joomla 网站的 url,我想查找 url 是否包含 alias= 如果它包含我需要从该页面隐藏标题

index.php?option=com_jomdirectory&view=item&id=18&alias=government1&categories_id=108&Itemid=110

到目前为止,我已经尝试将此代码放在我的 index.php 文件中,但它只搜索菜单项 ID

<?php /** Getting the Menu ID of Menu was clicked by user **/
$menu = &JSite::getMenu();
$id = $menu -> getActive() -> id;

/** Getting the Title of the Menu by using id. **/
$db = JFactory::getDBO();
$query = "SELECT title FROM sltdb_menu WHERE id = $id";
$db -> setQuery($query);
$rows = $db -> loadObjectList();
$itemrow = $rows[0];
$title = $itemrow -> title;

$url = JRoute::_('index.php?Itemid=' . $id);
if ($id >= 111 && $id <= 130) {
    echo "<style>#pageheading{ display: none;}</style><div > </div>";
}else {

    echo "";
}
?>

请解释如何查找alias=是否包含在 url 中?

4

1 回答 1

0

您可以检查特定部分的输入。

$app = JFactory::getApplication();
if ($app->input->get('alias'))
{
    echo 'I am included!';
    // Do what you need here
}
于 2014-03-05T12:53:18.120 回答