So this past week has been a nice week. I have finally found some time to clean up some projects and tweak some of my developer tools.

This post is dedicated to a build file I use in Netbeans for Joomla! Component Development.

Get it @ Github .

Like everyone else who writes Netbeans has recently included PHPUnit with its 6.8 version. I have the linux distribution, and am new to this so I am recording it for others to use.

Monday, 09 November 2009 15:53

Customizing Head tags Joomla...

Written by

You can download the plugin with the "Custom Header Plugin and Title Plugin for Joomla" link at the bottom of the page!


Customizing Head tags Joomla...
And maybe just removing the "Joomla! 1.5 - Open Source Content Management" from the generator tag...

When looking into this right off the bat (well almost, I spent a good deal of time digging around the Joomla core first) I found this:
http://www.wzcreativetechnology.com/joomla-tips-and-tricks/73-how-to-remove-meta-tag-qgeneratorq-in-joomla.html
And hey! this seemed reasonable enough. Simply altering, the template file seems to be a good option, because its straight forward.
Simply add:

$this->setGenerator('');

to the top of the template that you are currently using and there is your quick fix.
In fact, you can do this with all of your meta and other head tags right from the template (through related accessor methods).
However, one of the things that I really like about dynamically generated web sites is the ability to switch between templates and where ever possible I like to avoid hacking specific/concrete instances instead of abstracting the issue.

The entire content between the head tags is generated by /libraries/joomla/document/html/renderer/head.php (as mentioned in the above referrence page), and the code that is acuall responsible for loading that is in the JDocument class definition(/libraries/joomla/document/document.php), in the _loadRenderrer() method:

function &loadRenderer( $type )
    {
        $null    = null;
        $class    = 'JDocumentRenderer'.$type;

        if( !class_exists( $class ) )
        {
            $path = dirname(__FILE__).DS.$this->_type.DS.'renderer'.DS.$type.'.php';
            if(file_exists($path)) {
                require_once($path);
            } else {
                JError::raiseError(500,JText::_('Unable to load renderer class'));
            }
        }

        if ( !class_exists( $class ) ) {
            return $null;
        }

        $instance = new $class($this);
        return $instance;
    }



What jumps out at me is the fact, unlike some of the other Joomla core classes (like JModel, JView, JController) is that the $path variable is not built with a $this->_path array that could have been set as an alternative path to search before it finds the default.
For me, the work around comes from the conditional :
        if( !class_exists( $class ) )
This tells me that if we include our own definition of the JDocumentRendererHead class in a system plugin at onAfterRoute, then we can customize the header across all of our templates.



Saturday, 24 October 2009 19:08

K2: Custom Templates Featured

Written by

To override layouts in K2, you follow nearly the same process that you would in the Native Joomla content component. There is one slight difference though. It would seem that K2 .