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?
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 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 3 users)Note: You have to be a registered member to leave a comment. Free registration here. |
||
| Last Updated ( Tuesday, 29 April 2008 ) | ||
| < Prev | Next > |
|---|


May 12, 2008 3: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 3: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 8: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