J-D
J-D

Reputation: 774

joomla templating custom JDOC statements

Which Joomla Platform / CMS class should I extend in order to make my own custom JDOC:include tags?

I would like to have custom JDOC tags like

<JDOC:include type="scripts" />
<JDOC:include type="scripts-body" />

and a bunch of other types.

Upvotes: 2

Views: 95

Answers (1)

Rahul Kaushik
Rahul Kaushik

Reputation: 1464

You need to add new file at below location to add custom jdoc tag..

libraries/joomla/document/html/renderer/

File name should be same as the tag you are adding.. suppose you want to use scripts as tag then file name should be scripts.php

Now in this file you need to add below code. as tag name is scripts so class name should be JDocumentRendererScripts

<?php
defined('JPATH_PLATFORM') or die;

class JDocumentRendererScripts extends JDocumentRenderer
{
    public function render($scripts, $params = array(), $content = null)
    {
        $contents  = "";
        //Do your work here
        return $contents;

    }


}
?>

Now you can use custom jdoc code <JDOC:include type="scripts" />

Hope this helps..

Upvotes: 1

Related Questions