The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.



Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Thu Apr 26, 2012 8:15 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Tue Feb 24, 2009 8:17 pm
Posts: 165
Is there a way to post a Category Description to a Section Blog? It seems like an oddball request, but I've come across a section blog set up that requires a date to be posted on all Blogs that fall under a specific category. So all of these blog titles are listed in a Section blog, but there's this specific category that needs a description to be displayed and Joomla 1.5, out of the box, doesn't have the ability to show the Category Description with a Menu Item using a Section Blog layout.

Any ideas or hacks?


Top
 Profile  
 
PostPosted: Fri Apr 27, 2012 2:35 pm 
Joomla! Explorer
Joomla! Explorer

Joined: Tue Feb 23, 2010 8:16 pm
Posts: 294
Location: Lancaster UK
This code placed in your templates index.php file allows you to set manual description and keywords based on the menu id

Code:
<?php
$currentMenuId = JSite::getMenu()->getActive()->id ;
if($currentMenuId == '116') // 116 is the ID number of the menu pointing to the component
{
$this->setMetaData( 'description', 'my description' );
$this->setMetaData( 'keywords', 'my keyword' );
}
else
{
// do nothing
}
?>


Just change 116 to the required menu id.

_________________
Joomla Expert http://www.deanmarshall.co.uk/joomla-expert.html Expert Joomla Development and Support
Music For Schools http://www.musicforschoolsltd.co.uk/ Primary Schools Summer Musicals


Top
 Profile  
 
PostPosted: Fri Apr 27, 2012 2:50 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Tue Feb 24, 2009 8:17 pm
Posts: 165
Harvey51 wrote:
This code placed in your templates index.php file allows you to set manual description and keywords based on the menu id

Code:
<?php
$currentMenuId = JSite::getMenu()->getActive()->id ;
if($currentMenuId == '116') // 116 is the ID number of the menu pointing to the component
{
$this->setMetaData( 'description', 'my description' );
$this->setMetaData( 'keywords', 'my keyword' );
}
else
{
// do nothing
}
?>


Just change 116 to the required menu id.


You mention my template index.php, but it doesn't show that. R U referring to the Section Blog layout template file? or something different?


Top
 Profile  
 
PostPosted: Mon Apr 30, 2012 10:17 am 
Joomla! Explorer
Joomla! Explorer

Joined: Tue Feb 23, 2010 8:16 pm
Posts: 294
Location: Lancaster UK
No, you need to add it to your template's index.php file. Inside the head but outside of any existing php tags.

i.e after - ?>

_________________
Joomla Expert http://www.deanmarshall.co.uk/joomla-expert.html Expert Joomla Development and Support
Music For Schools http://www.musicforschoolsltd.co.uk/ Primary Schools Summer Musicals


Top
 Profile  
 
PostPosted: Mon Apr 30, 2012 3:26 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Tue Feb 24, 2009 8:17 pm
Posts: 165
Thank you for the clarification, Harvey51:

I guess it's not working in the way I want it to because the category description is not displaying in the Section Blog with the appropriate Menu ID.

To give a visual: Menu Item link is Section>Blog

Section Heading

Category Heading
Category description

Articles associated with category listed

This is what I would like to display.


Top
 Profile  
 
PostPosted: Tue May 01, 2012 9:21 am 
Joomla! Explorer
Joomla! Explorer

Joined: Tue Feb 23, 2010 8:16 pm
Posts: 294
Location: Lancaster UK
Just to clarify, when you say category description are you talking about text that you can see on the page, or a meta description?

I thought you meant meta description, but looking back you probably mean visible text.

_________________
Joomla Expert http://www.deanmarshall.co.uk/joomla-expert.html Expert Joomla Development and Support
Music For Schools http://www.musicforschoolsltd.co.uk/ Primary Schools Summer Musicals


Top
 Profile  
 
PostPosted: Tue May 01, 2012 9:30 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Tue Feb 24, 2009 8:17 pm
Posts: 165
I was talking about the Category Description and not the Meta Description. :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 



Who is online

Users browsing this forum: Yahoo [Bot] and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group