How to make plugins process Section/Category descriptions (for Joomla 1.5.x)? |
| Written by kksou | ||
| Monday, 28 April 2008 | ||
|
In standard Joomla 1.5.x installation, only the content items get processed by the mambots/plugins. This article shows you how to make the mambots/plugins process the Section/Category descriptions too. Note: the steps below are for Joomla 1.5.x. If you're using Joomla 1.0.x, please refer to How to make plugins process Section/Category descriptions (for Joomla 1.0.x)?. Solutions
class ContentViewCategory extends ContentView
{
function display($tpl = null)
{
global $mainframe, $option;
// Initialize some variables
$user =& JFactory::getUser();
$uri =& JFactory::getURI();
$document =& JFactory::getDocument();
$pathway =& $mainframe->getPathway();
$category =& $this->get('Category');
$dispatcher =& JDispatcher::getInstance();
JPluginHelper::importPlugin('content');
$category->text = $category->description;
$results = $dispatcher->trigger('onPrepareContent',
array (&$category, $category->params, 0));
$category->description = $category->text;
// Get the menu item object
$menus = &JSite::getMenu();
$menu = $menus->getActive();
class ContentViewSection extends ContentView
{
function display($tpl = null)
{
global $mainframe, $option;
// Initialize some variables
$user =& JFactory::getUser();
$document =& JFactory::getDocument();
$section =& $this->get('Section');
$dispatcher =& JDispatcher::getInstance();
JPluginHelper::importPlugin('content');
$section->text = $section->description;
$results = $dispatcher->trigger('onPrepareContent',
array (&$section, $section->params, 0));
$section->description = $section->text ;
// Get the page/component configuration
$params = &$mainframe->getParams();
// Request variables
$limit = JRequest::getVar('limit', $params->get('display_num'), '', 'int');
$limitstart = JRequest::getVar('limitstart', 0, '', 'int');
class ContentViewSection extends ContentView
{
function display($tpl = null)
{
.
.
.
//add alternate feed link
if($params->get('show_feed_link', 1) == 1)
{
$link = '&format=feed&limitstart=';
$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
$document->addHeadLink(JRoute::_($link.'&type=rss'),
'alternate', 'rel', $attribs);
$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
$document->addHeadLink(JRoute::_($link.'&type=atom'),
'alternate', 'rel', $attribs);
}
$dispatcher =& JDispatcher::getInstance();
JPluginHelper::importPlugin('content');
for($i = 0; $i < count($categories); $i++)
{
$category =& $categories[$i];
$category->link = JRoute::_('index.php?view=category&id='.
$category->slug);
$category->text = $category->description;
$results=$dispatcher->trigger('onPrepareContent',
array(&$category, $category->params, 0));
$category->description = $category->text ;
}
if ($total == 0) {
$params->set('show_categories', false);
}
That's it. You can try {loadposition}. It should now work even in Section/Category descriptions. You can also try DirectPHP plugin. You will now be able to include PHP commands in both the content items as well as Section/Category descriptions. Note
User reviews Average user ratings: 5.0 (from 5 users) Note: You have to be a registered member to leave a comment. Free registration here. |
||
| Last Updated ( Tuesday, 29 April 2008 ) | ||
| < Prev | Next > |
|---|
Joomla 1.0 Articles
- How to create a module with DirectPHP plugin?
- How to include modules in Content item?
- How to include modules in Section/Content Description
- How to include PHP commands in Section/Content Description
- How to make plugins process Section/Category descriptions
- Include Code Listing plugin - More Tips and Techniques
- How to have DirectPHP plugin process RSS feed?
- How to have the plugins processed when genrating PDF documents of content items?
- How to have DirectPHP commands processed in Joomla search?
Joomla 1.5 Articles
- How to create a module with DirectPHP plugin?
- How to include modules in Content item?
- How to include modules in Section/Content Description
- How to include PHP commands in Section/Content Description
- How to make plugins process Section/Category descriptions
- Include Code Listing plugin - More Tips and Techniques
- How to have DirectPHP plugin process RSS feed?
- How to have the plugins processed when genrating PDF documents of content items?
- How to have DirectPHP commands processed in Joomla search?
Joomla Plugins
Joomla Components
Joomla Gadgets
- Google Image Search
- Google News Search
- Wikipedia Search
- Google Book Search
- Google Video Search
- Google Currency Converter - AJAX version
- Yahoo Currency Converter - AJAX version
- Yahoo Stock Quote (AJAX module version)
- Yahoo Stock Quote (AJAX component/ module version)
- googleSearch_cse component
- googleSearch_cse module
- googleMaps plugin








May 12, 2008 2:15am
//add alternate feed link
if($params->get('show_feed_link', 1) == 1)
{
$link = '&format=feed&limitstart=';
$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
$document->addHeadLink(JRoute::_($link.'&type=rss'), 'alternate', 'rel', $attribs);
$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
$document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs);
}
// I don't know where to put your hack, this is line 85 of /components/com_content/views/section/view.html.php
// Prepare section description
$section->description = JHTML::_('content.prepare', $section->description);
for($i = 0; $i < count($categories); $i++)
{
$category =& $categories[$i];
$category->link = JRoute::_('index.php?view=category&id='.$category->slug);
May 12, 2008 2:43am
Hi Giorez,
Which version are you using? Would you mind email me the entire view.html.php? Need more lines before and after to tell you where to add the lines.
Regards,
/kksou
May 12, 2008 7:09am
Hi Giorez,
Thanks for emailing me the file.
I've been using Joomla 1.5.1 all these while. I just installed Joomla 1.5.3, and to my surprise, it seems that in v1.5.3, the section/category description now gets processed by the content plugins by default! You do not need to add any additional code as described in this article.
Would you want to give it a try and see if this is the case?
Regards,
/kksou
November 21, 2008 7:15am
I copy and pasted the code in line 39 and it looks exactly like your example, except none of my plugins are showing up at all in the cateogy description - and i didnt try the section description yet.
November 24, 2008 1:52am
Hi Chad,
1) Which Joomla version are you using? If you're using v1.5.3, you might not even need those additional code. (See the note just above your comments)
2) Have you tried this on a fresh install of Joomla? It helps you see if the above works at all on your machine.
Regards,
/kksou