• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How to return a new template templaterTemplatePostRender

XenConcept

Formerly Rémi C
#1
How to return a new template with the event
templaterTemplatePostRender

Code :

Code:
 /**
     * @param Templater $templater | Templater Object
     * @param $type | Template Type
     * @param $template | Template Name
     * @param $output   | Rendered output
     */
    public static function templaterTemplatePostRender(Templater $templater, $type, $template, &$output)
    {
        if($template === 'error')
        {

            $templateRender = $templater->includeTemplate('rd_four_oh_four_error');

            $output = $templateRender;


            \XF::dump($templateRender);
        }
    }
Error :

Code:
Template errors

    Template :rd_four_oh_four_error: Template :rd_four_oh_four_error is unknown (src/XF/Template/Templater.php:498)
 

Chris D

XenForo developer
Staff member
#4
Do a search in all of the XF files for the following ->renderTemplate('. There should be a few examples, can you spot anything different about them that you might have missed?
 

Chris D

XenForo developer
Staff member
#6
Do you not see that most of the templates called like this have a prefix, e.g. ->renderTemplate('public:.

You need to prefix your template name with the template type (admin, email or public).