How to include modules in Section/Content Description (for Joomla 1.5.x)? |
| Written by kksou | ||
| Sunday, 20 April 2008 | ||
|
This is in response to Filipe Torres's post titled "How to include modules in section/category description". The standard mosloadposition plugin that comes bundled with the original Joomla 1.5.x installation only allows you to include modules in content items. This article shows you how to include modules in Section/Category description. You can see a live example here. Note: Please refer to the following post in Joomla forum: http://forum.joomla.org/viewtopic.php?p=1295599#p1295599 I think starting Joomla 1.5.3, you do not need the fix as outlined in steps 4 and 5. The section/category description now gets processed by the content plugins by default. 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');
$results = $dispatcher->trigger('onBeforeDisplayTitle', array (& $category));
// 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');
$results = $dispatcher->trigger('onBeforeDisplayTitle', array (& $section));
// 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);
$results=$dispatcher->trigger('onBeforeDisplayTitle', array(&$category));
}
if ($total == 0) {
$params->set('show_categories', false);
}
User reviews Average user ratings: 4.5 (from 11 users) Note: You have to be a registered member to leave a comment. Free registration here. |
||
| < 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








4.5 (from 11 users)
June 11, 2008 4:06pm
I dont undestand i found the view.html.php but what about content.html.php?... i cant found this... so... y create this or where coul i foun it?...
June 11, 2008 5:47pm
oops, it's a typo. Both should be view.html.php.
Have fixed them in the document.
Thanks for pointing this out.
Regards,
/kksou
June 12, 2008 6:11pm
Tnks a lot... so i have a new question, i can use {loadposition position} but when i use {loadmodule mod_namemodule} it dont do any thing just display the text {loadmodule mod_namemodule}... coul you explain me how could i do it?
June 13, 2008 2:44am
Please refer to the following article which shows you how to set up a new module position. You have to use module position, not the name of the module.
How to include modules in Content item (for Joomla 1.5.x)
Regards,
/kksou
July 18, 2008 4:05pm
I have J1.5.1. Passed all the steps from the manual, cheked many times...not working.
http://www.edemvkrim.com/index.php?option=com_content&view=category&id=34&Itemid=54
In the example i've installed Simple SlideShow and placed it in "left" position. There it works. But not in the section description.
Help! Need this thing very much!
July 18, 2008 5:14pm
But it works fine on localhost...
July 19, 2008 5:31am
Hi Boreus,
Have looked at your website.
1. Some slideshow module will only allow one slide show per webpage. You may want to check this first.
2. You shouldn't be using {loadposition left} in the section description. The module position "left" is the predefined position on the left. If you want to display a module in the section description, you have to create a new module position, e.g. user201. (Please refer to the article: How to include modules in Content item if you're not sure how to do this.) Then you need to publish the module to this position for the module to appear there.
3. If your slideshow module supports displaying of slideshows in two module positions, then you have to create a duplicate of the slideshow module. Then you publish one in the "left" module position, and the other in the new module position you've created.
4. Did you modify the view.html.php and add the trigger to call the plugin (as described above in this article)? It looks to me that the loadposition plugin is not called. You might want to double check this.
Regards,
/kksou
July 20, 2008 8:05am
Hi, kksou,
Thanx a lot for such a detailed description!
Did all as you've told:
Now the slideshow module is published only once in the "user201" position.
Double checked view.html.php file, compared it with the one on localhost - the same thing, everything as in article above. Strangely enough, {loadposition user201} loads slideshow in the arcticle content just fine.
Here it is: link
What else should i check?
It would be so incredible if it works out! The plugin is really awesome!
September 21, 2008 3:31pm
I was hoping this would work out of the box for the categories in Virtuemart but alas no!
I don't suppose anyone would have an idea how I would adapt it to do this??
(thanks)
October 06, 2008 5:06am
have a nice day.
in the articles has written:
"# Add Trigger for Section Description. If you also want to include modules for Section Description, you also need to add a trigger as explained above.
1. Go to the folder /components/com_content/views/section, you will see a file called view.html.php."
in that file i found this around the lines 87:
"//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);
}
$menus = &JSite::getMenu();
$menu = $menus->getActive();
// because the application sets a default page title, we need to get it
// right from the menu item itself
if (is_object( $menu )) {
$menu_params = new JParameter( $menu->params );
if (!$menu_params->get( 'page_title')) {
$params->set('page_title', $section->title);
}
} else {
$params->set('page_title', $section->title);
}
$document->setTitle( $params->get( 'page_title' ) );
// Prepare section description
$section->description = JHTML::_('content.prepare', $section->description);
for($i = 0; $i < count($categories); $i++)
{
$category =& $categories[$i];
$category->link = JRoute::_(ContentHelperRoute::getCategoryRoute($category->slug, $category->section).'&layout=default'); ""
that is too different from the example.
what error i did? is a normal installation
Best regards
N6
October 06, 2008 5:50am
Hi N6,
Please refer to the following post in Joomla forum:
http://forum.joomla.org/viewtopic.php?p=1295599#p1295599
I think starting Joomla 1.5.3, you do not need the above fix. The section/category description now gets processed by the content plugins by default.
Regards,
/kksou