Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Recipe help for displaying menu for...
Recipe help for displaying menu for one category of articles
Recipe help for displaying menu for one category of articles
I'd like to display mod_mainmenu (ID=1) for one category, ID=460. I found the recipe on your site and altered it to fit my needs:
Code:
$category_id = null;
if ( $option == "com_content" ) {
if ( $view == "category" ) {
/* category list pages (blog or list style) */
$category_id = (int)$id;
} else if (array_key_exists("catid",$_REQUEST)) {
/* if the category id is in the URL */
$category_id = (int)JRequest::getInt("catid",0);
}
if ( $category_id === null && $view == "article" ) {
/* if it's an article page without the catid mentioned in the url */
$nullDate = $db->Quote($db->getNullDate());
$my_id = $db->getEscaped((int)$id);
$query = "SELECT title, id, catid "
. " FROM #__content WHERE id = '$my_id' AND state = 1"
. " AND ( publish_up = " . $nullDate
. " OR publish_up <= CURRENT_TIMESTAMP )"
. " AND ( publish_down = " . $nullDate
. " OR publish_down >= CURRENT_TIMESTAMP )";
$db->setQuery( $query, 0, 1 );
$row = $db->loadObject();
$category_id = $row->catid;
}
}
/* Now customise any of the following rules for your use.
* $category_id will correspond to the category id of the
* article being displayed (if one is being displayed!)
*/
if ($category_id == 460) return 1;/* on category 460, return module 1 */
I must have something wrong though because if you go to one of the pages that's in that category, no menu appears in the left column:
http://www.redkitecreative.com/projects … ocked.html
In mod_metamod I have the menu selection as 'None' and it is published in the left position. I'm using Joomla 1.5.14 and MetaMod 1.5j, can you help me out?
Re: Recipe help for displaying menu for one category of articles
Hi Kanjigirl,
You mentioned that you have the Menu Selection as "none" in MetaMod - that's the problem.
Set Menu Selection to "none" in the module you are including, not in MetaMod! The MetaMod has to be set up as a fully published module in the normal way, but the module you are including has to be set to "none" so that it doesn't show up by itself, only when it's included by the MetaMod.
Hope that helps,
Stephen
- Index
- » MetaMod
- » MetaMod General Support
- » Recipe help for displaying menu for...
Board Info
- Board Stats:
- Total Topics:
- 1699
- Total Polls:
- 6
- Total Posts:
- 5965
- Posts this week:
- 3
- User Info:
- Total Users:
- 8012
- Newest User:
- grant1ab
- Members Online:
- 0
- Guests Online:
- 187
- Online:
- There are no members online
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked