Wednesday, November 11, 2009

template customization by checking url condition in joomla

we want to check the URl for particular parameter or option then provide condition in the template:


<?php
$option=$_REQUEST['option'];
$id=$_REQUEST['id'];
if($option=='com_content'&& ($id==45||$id==44||$id==6))
{
?>
<?
}

?>


hope it will help you.


<?php
$menus = &JSite::getMenu();
$menu = $menus->getActive();
$itemid = $menu->id;

$idd=$_REQUEST['id'];

echo "ItemID is:".$itemid."ArticleID is:".$idd;
?>




Get active menu linked Content's section Id and category Id in Joomla1.5.x






$menus = &JSite::getMenu();
$currentMenu = $menus->getActive();
$menuOption=$currentMenu->query['option'];

if($menuOption=='com_content'){
$menuView=$currentMenu->query['view'];
if($menuView=='section'){
$secid=$currentMenu->query['id'];
}
elseif($menuView=='category'){
$catid=$currentMenu->query['id'];
}
else if($menuView=='article'){
$articleId=$currentMenu->query['id'];
$sql = "SELECT c.sectionid,c.catid"
. "\n FROM #__content AS c"
. "\n WHERE c.id = ".$articleId;
$database->setQuery( $sql );

$sectionCat = $database->loadObjectList();
if(count($sectionCat)){
$secid=$sectionCat[0]->sectionid;
$catid=$sectionCat[0]->catid;
}
}
}

5 comments:

  1. Get active menu linked Content's section Id and category Id in Joomla1.5.x will be helpful :)

    ReplyDelete
  2. Such a Wonderful information about Joomla you shared in this post! Thanks
    VirtueMart Shopping Cart

    ReplyDelete
  3. Thanks for your code. Its really good experiment to get clarified in that. Keep going.
    html5 video player| html5 player

    ReplyDelete
  4. Your blog is really one amongst my most favorite blogs, it’s so creative. http://www.lowhosting.com/bluehost-review/

    ReplyDelete
  5. Your blog is really one amongst my most favorite blogs, it’s so creative. http://www.lowhosting.com/bluehost-review/

    ReplyDelete