Category Description in item template?

More
12 years 3 months ago #27749 by mpearl
We're adding a block of html as a description for each category - the block of html is a <div> with background image (different for each), with a text overlay.

We'd like to display the same html block at the top of each item in that category. We're using $this->category->description within the category_category.php file, but that's not available within item.

How can I access the parent category's description from within the item.php template?

Thanks!

Mike

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #27757 by micker
why you didn't use a flexicontent module to load description ?

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #27758 by ggppdk
You can use this one (since this is requested from time to time, maybe we should and a parameter for this one, and then add the ability to item layout)
Code:
<?php // First try current category id from the HTTP request $cid = JRequest::getInt('cid'); // if current category not set, then use item's main category $cis = $cid ? $cid : $this->item->catid; // get data from DB $db = &JFactory::getDBO(); $q = 'SELECT * FROM #__categories WHERE id =' . $cid; $db->setQuery($q); $catdata = $db->loadObject(); // output category data echo $catdata->title."<br>"; echo $catdata->description; ?>


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
The following user(s) said Thank You: weCombine

Please Log in or Create an account to join the conversation.

More
12 years 2 weeks ago #30401 by yanndev

ggppdk wrote: You can use this one (since this is requested from time to time, maybe we should and a parameter for this one, and then add the ability to item layout)


Thanks !

just little error in the code, the double point :
Code:
$db = &JFactory::getDBO();

(joomla 2.5.7 / flexi 2.0)

xhtml/html/css/js/php...

Please Log in or Create an account to join the conversation.

More
12 years 2 weeks ago #30404 by ggppdk
Corrected it above, thanks


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.403 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline