outputFrontendTemplate

The outputFrontendTemplate hook is triggered when a front end template is printed to the screen. It passes the template content and the template name as arguments and expects the template content as return value.

Note

This hook is applied before the replacement of insert tags whereas the corresponding modifyFrontendTemplate is applied after insert tags have been replaced.

Available

from Contao 2.6.0.

Parameters

  1. string $buffer

    Content of the rendered front end template.

  2. string $templateName

    The template name (e.g. fe_page) without file extension.

Return Values

Return the original $buffer or override with your custom modification.

Example

<?php

// config.php
$GLOBALS['TL_HOOKS']['outputFrontendTemplate'][] = array('MyClass', 'myOutputFrontendTemplate');

// MyClass.php
public function myOutputFrontendTemplate($buffer, $templateName)
{
    if ('fe_page' === $templateName) {
        // Modify output
    }

    return $buffer;
}

More information

References

See also

results matching ""

    No results matching ""