I realize this is an extension 101 level question, but through searching and looking at some existing extensions, I can't find the best approach. I'm coming from years on a phpBB 3.0 install for a very large community (>40M posts). We have a ton of core file modifications that I'm now migrating to 3.2 extensions.
One very simple thing I'd like to do is override the main viewtopic template based on a URL parameter. E.g.:
Code: Select all
Hope this makes sense so far.
One approach I've considered is to just look for this apiview URL parameter in my extension's main class constructor and use the $template->set_custom_style() function, because this same approach may be used to override other templates.
Is there a better approach here? Should I be using an event listener and modifying the template files based on that? The template events seem ideal for injecting new template code, but in my case, I need to remove a good deal of includes. I didn't see a php event specifically for template application.
Cheers and thanks for any help
EDIT: I suppose this could also be done without an extension, by using Twig functions in my viewtopic_body.html template to check for the URL parameter, and adjust things accordingly. But I'd love to keep my modifications isolated in extensions that can be easily turned on/off and versioned separately from the rest of the styles.