Search code examples
phpurlmodulejoomla3.2

how to find a specific part from joomla url?


This is url of my joomla site , i want to find whether the url contain alias= if its contain i need to hide header from that page

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

so far i have tried putting this code on my index.php file , but it only search menu item 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 "";
}
?>

Please explain how to find whether the alias= is included to url ?


Solution

  • You can check input against to the specific part.

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