I have a situation whereby i want two of my pages to look different form the rest but they are not front pages. If they were it would be easy as the code below would do the trick.
$menu = & JSite::getMenu();
if ($menu->getActive() == $menu->getDefault()) {
echo 'This is the front page';
esle(do something else)
}
?>
In short i want a similar approach but this time, to get the menu by ID/URL. Any ideas?
I got the answer to this...all you need to check is the menu ID then put the code below.
<?php
//This is the code for the page with menu ID 6
$menuID = JSite::getMenu()->getActive()->id ;
if ($menuID == '6')
{
echo '';
}
elseif ($menuID == '2') //This is the HTML for page with menu ID 2
{
echo '';
}
elseif ($menuID == '4') //THis is the html for page with menu id 4
{
echo '';
}
else //This is the HTML code for the rest of the pages
{
echo '';
}
?>
Page ItemId can be obtained using $itemid = JRequest::getInt( 'Itemid' );