Making JReviews Menus active when viewing listing detail pages

From JReviews Documentation
Revision as of 19:43, 6 January 2010 by Jreviews (Talk | contribs) (Created page with 'When someone views listing detail page, the JReviews Section/Category menu items will not became active. That is because listings don't share the same ItemIds as JReviews Sectio…')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

When someone views listing detail page, the JReviews Section/Category menu items will not became active.

That is because listings don't share the same ItemIds as JReviews Section/Category menu items.

Listings have the ItemIds of the Joomla Article Section/Category menu items.

You probably created those menu items in a Hidden Menu. If not, do that like instructed in this article: Using Joomla Core SEF - Creating Joomla Article Section/Category Menu Items (at the bottom of the article)


When you know the Ids of Hidden Joomla menu items and Ids of JReviews menu items, you can add a hack in the index.php file of your joomla template:


Open this file:

  • root\templates\{your_template}\index.php


The first lines in the file probably look something like this:

<?php
( '_JEXEC' ) or die( 'Restricted index access' );
define( 'YOURBASEPATH', dirname(__FILE__) );
?>


Add this hack above the closing php tag:

global $Itemid;
$menu = &JSite::getMenu();
 
// Repeat for every JReviews menu that needs to become active
if($Itemid == 125){  // example of the itemId of Joomla menu item
    $menu->_active = 48; // example of the itemId of JReviews menu item
}


Now the JReviews menu item with Id 48 will become active when the listing detail page with itemId 125 is viewed.