如何从joomla url中找到特定的部分?

时间:2014-03-05 12:48:00

标签: php url module joomla3.2

这是我的joomla网站的网址,我想查找网址是否包含别名=如果其包含我需要隐藏该网页的标题

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 = 是否包含在网址中?

1 个答案:

答案 0 :(得分:0)

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

$app = JFactory::getApplication();
if ($app->input->get('alias'))
{
    echo 'I am included!';
    // Do what you need here
}