HOOK that executes AFTER inserttags have been replaced
I'm looking for access to the rendered Frontend Template page, AFTER the inserttags have been replaced. If the image_headline extension is to work fully, it must be able to replace text, AFTER the inserttags have been replaced. THEN only can I replace the text with images, otherwise, the replaced text not yet available for replacement. This also means that any modules or aricles that have been included using an inserttag {{insert_article::3}} will also not render and the content cannot be image headlined.
The current HOOK doesn't work:
Code:
$GLOBALS['TL_HOOKS']['outputFrontendTemplate'][] = array('ImageHeadline', 'replaceHeadlines');
Re: HOOK that executes AFTER inserttags have been replaced
Maybe a stupid idea, but what about using inheritance?
Code:
<?php
class MyHookingClass extends Controller
{
protected function replaceInsertTags($strBuffer, $blnCache=false)
{
parent::replaceInsertTags($strBuffer, $blnCache=false);
// do my code or provide another hook
}
}
Re: HOOK that executes AFTER inserttags have been replaced
Since the ONLY place the image_headline extension enters the TL/Contao code is via a hook and to make inheritence work, I'd need to have my HOOK class be an override for Controller.
The easiest solution dawned on me -- which would not be an efficient solution and a duplication in Tl core code, but will work. Simply run replaceInsertTags through the output buffer before I start working on the output buffer. I'd just think that it would be quite simple for TL to just add a HOOK to access the buffer at the point AFTER replacing inserttags, at the page render view, e.g.
My new HOOK would be outputFrontendPageContent (which would provide the page content after the page was run past "replaceInserttags"
Code:
$GLOBALS['TL_HOOKS']['outputPageContent'][] = array('ImageHeadline', 'replaceHeadlines');
Re: HOOK that executes AFTER inserttags have been replaced
I actually needed this same thing recently. For SEO purposes, I needed to replace all links to the home page with ones that don't refer to it by alias (i.e. http://mysite.com/home.html needed to become just http://mysite.com). And just found out (the hard way) that insert tags are replaced after this hook, so it missed a few.
Just by reading the descriptions, it would seem that parseFrontendTemplate would fire before inserttags are replaced, and outputFrontendTemplate would fire after, but obviously this is not the case. If not, what's the difference between these two hooks?
Do you know if anyone has requested this as a feature yet?
Thanks!
Re: HOOK that executes AFTER inserttags have been replaced
Regarding SEO and removing home.html, you will find that this extension covers that, plus some other goodies:
googlesitemap
Prior to using this extension I was using a .htaccess RewriteRule that also worked quite well.
Hope that is in some way helpful info ;-)
Do you also force the use of www. ?
Re: HOOK that executes AFTER inserttags have been replaced
Is there any solution for image_headline to replace font after the replaceInsertTags ??