Custom Plus Module

Advanced custom module which allows you to enter php/js to articles and add custom code to the document head section.

Release Candidate 1.0

Maturity:
Release Candidate
Released on:
Wednesday, 21 September 2011 00:00
Viewed:
2454 times

I created this module to be able to add text to a component view and override the page title, meta description and meta keywords. I also added the functionality to add extra css and general code to the head section.

Normally there is no option in a menu item to add a description. With this module and a simple template override you can add introtext, footer text or text anywhere in the component and override the page meta tags and title.

To add a module position to your component view, you should first override the view. for example:

To override the listings view of Joomla Estate Agency, first move the file

/components/com_jea/views/properties/tmpl/default.php
To:
/templates/YOURTEMPLATE/html/com_jea/properties/default.php

This file now overrides the original. To insert a module position, add the following code (within php tags).

/***************************************
* Load module in the component*/

jimport('joomla.application.module.helper');
// this is where you want to load your module position
$modules = JModuleHelper::getModules('htmlplus');
foreach($modules as $module)
{
echo JModuleHelper::renderModule($module);
}

Modules can now be assigned to the 'htmlplus' position

You can download this code in a text file here

You can change the getmodules line to another module position and use it again elsewhere in the file to load 2 modules (eg, intro-text at the top and footer text at the bottom). You only need to use this module once, any other positions added you can just use the standard custom html module.

Add your page title, new meta description and keywords and save it!

View files