phpBB

Development Wiki

Difference between revisions of "Add Template Listeners"

From phpBB Development Wiki

(Created page with "==What are template listeners?== Template listeners are a way of injecting code into the template files. The can be injected at any place where events are used. They are p...")
 
(moved to new docs)
 
(8 intermediate revisions by 6 users not shown)
Line 1: Line 1:
==What are template listeners?==
+
This documentation has been moved to the new phpBB Development Documentation.
Template listeners are a way of injecting code into the template files. The can be injected at any place where [[events]] are used. They are part of the [[listeners]] system added in 3.1
+
  
==How to use one==
+
[https://area51.phpbb.com/docs/dev/31x/extensions/tutorial_events.html#template-events-listeners Extensions: Template Events & Listeners].
I'm assuming you already know what the events's identifer is. If you don't then you should look it up on the [[Events_List]]. If it isn't on the events list you can add it as described in the [[Adding_Events]] article.
+
 
+
So lets say our event is called overall_header_head and injects into overall_header.html in the head element.
+
 
+
You create a file in your extension in <pre>ext/extname/styles/stylename/template/overall_header_head.html</pre>
+
 
+
You essentially call the file by the event identifier followed by .html
+
 
+
Then you type in the content you want to be injected where that event is and your good to do. Its as simple as that.
+
 
+
If you want it to work for all styles (recommended) then instead of style name use `all`.
+
 
+
[[Category:Events and Listeners]]
+

Latest revision as of 18:43, 5 December 2016

This documentation has been moved to the new phpBB Development Documentation.

Extensions: Template Events & Listeners.