Extensions and phpBB 3.2: you should probably read this topic

Discussion forum for Extension Writers regarding Extension Development.
User avatar
JoshyPHP
Code Contributor
Posts: 1291
Joined: Mon Jul 11, 2011 12:28 am

Re: Extensions and phpBB 3.2: you should probably read this topic

Post by JoshyPHP »

There's nothing in the library that will let you inject HTML at any point during the parsing or rendering process. What you can do is postprocess the HTML using the core.text_formatter_s9e_render_after event.

Also, template parameters are different from the tokens/placeholders used when defining BBCodes. There's an example at http://s9etextformatter.readthedocs.io/ ... arameters/
I wrote the library that handles markup in phpBB 3.2+.
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco

Re: Extensions and phpBB 3.2: you should probably read this topic

Post by 3Di »

Zukero wrote: Mon Dec 25, 2017 10:02 pm I'm trying to write an extension for phpbb 3.2 that adds a custom bbcode.
I am using a migration to add a bbcode, the one below is compatible 3.1/3.2
(the 3.2 HTML replacement has been kindly suggested by JoshyPHP)
https://github.com/3D-I/notebbcode/blob ... code_1.php

Hope this helps. :)
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
Zukero
Registered User
Posts: 52
Joined: Fri Oct 16, 2015 9:19 am

Re: Extensions and phpBB 3.2: you should probably read this topic

Post by Zukero »

Thanks for your help. The "...render_after" event made it, although I think it is a rather inefficient way of doing it.

I'd like to be able to set an output token's value from php, potentially using output tokens that aren't defined in the input bbcode, for example
BBCode:

Code: Select all

[tag]{TEXT1}[/tag] 
Replacement:

Code: Select all

<a href="{TEXT2}" class="{TEXT3}">{TEXT1}</a>
With TEXT2 and TEXT3 created in php using TEXT1 as parameter.
User avatar
JoshyPHP
Code Contributor
Posts: 1291
Joined: Mon Jul 11, 2011 12:28 am

Re: Extensions and phpBB 3.2: you should probably read this topic

Post by JoshyPHP »

If the intent is to inject HTML then no, that will almost certainly never be supported. If you want to replace some metadata in the XML you can take a look at phpbb\textformatter\s9e\quote_helper and the quote_extended template.

I don't believe modifying the HTML with string functions is inefficient. It's probably the most efficient way to do it.
I wrote the library that handles markup in phpBB 3.2+.

Return to “Extension Writers Discussion”