[RFC] Events for template compilation and rendering

Note: We are moving the topics of this forum and it will be deleted at some point

Publish your own request for comments/change or patches for the next version of phpBB. Discuss the contributions and proposals of others. Upcoming releases are 3.2/Rhea and 3.3.
Post Reply
User avatar
Arty
Former Team Member
Posts: 985
Joined: Wed Mar 06, 2002 2:36 pm
Location: Mars
Contact:

[RFC] Events for template compilation and rendering

Post by Arty »

Currently extension authors can inject HTML code only in few predefined places. That is not enough.

I suggest to implement 2 events:

1. template_compile - event to be ran before template compilation. Parameters should be template name and template content. It would allow extension author to change content of template before it is compiled, inserting code anywhere.

2. template_post_render - event to be ran after template is parsed. Parameters should be template name and HTML code outputted by template engine. It would allow extension author to change HTML output after template is rendered.

Possible downside is there could be conflicts between styles and extensions trying to replace code that doesn't exist in style or between extensions and other extensions trying to change same code. So I think those events should be last resort, used only when there are no template events that extension can use.

It wasn't possible to implement with old template system, but with TWIG it should be doable.

User avatar
imkingdavid
Registered User
Posts: 1050
Joined: Thu Jul 30, 2009 12:06 pm

Re: [RFC] Events for template compilation and rendering

Post by imkingdavid »

1. should be "template_compile_before"
2. should be "template_render_after"

I'm okay with implementing this. Eventually we should add an admin interface to somehow enable/disable extensions being able to use these events in case one conflicts or breaks things.
I do custom MODs. PM for a quote!
View My: MODs | Portfolio
Please do NOT contact for support via PM or email.
Remember, the enemy's gate is down.

Alien_Time
Registered User
Posts: 165
Joined: Fri Apr 05, 2013 3:38 am

Re: [RFC] Events for template compilation and rendering

Post by Alien_Time »

This will be very useful if it can be done!

Post Reply