If you use a plain joomla 2.5.x / 3.0.* (for 3.5.* see update below) installation and check the generated source code you can see that the CMS pushed every header line generated by the <jdoc:include type="head" /> onto a new line. You wish to change that so that your source is more "compressed". How can you do that?

1.) Copy the file "/libraries/joomla/document/html/renderer/head.php" to your template root folder and name it renderer_header.php.

2.) Edit your index.php and add the following:

require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'head_renderer.php';

Now you can change the output from <jdoc:include type="head" />. To do that you need to change the source code in the renderer_header.php file. Now change the buffer variable and remove the $tab and $lnEnd variables.

Here is a short example the old line:

$buffer .= $tab . $custom . $lnEnd;

must be changed to:

$buffer .= $custom;


Update for Joomla 3.5.*:

Since joomla3.5 the class JDocumentRendererHead is deprecated and replaced with JDocumentRendererHtmlHead. So if you wish to use your Joomla 2.5/3.0 template with Joomla 3.5 you need to modifize your renderer_header.php file and change JDocumentRendererHead to JDocumentRendererHtmlHead


Cross reference:
edit the output of jdoc:include type=head via renderer/head.php

Leave your comments

Post comment as a guest