With PHPBB is it possible to use PHP scripts with custom BBCodes?
An example use would be if i wanted to grab today's weather with Curl and then display it on a forum post as text data.
I have tried to add php code directly in the BBCode but it does not work, i have also tried to return an echo from JS but it didn't seem to work either.
I also tried this but it did not work:
<!-- PHP --><?php echo 'hello'; ?><!-- ENDPHP -->
How would i run some PHP code in a custom BBCode?
Still not sure I fully understand the question but:
According to http://php.net/manual/en/function.bbcode-create.php you can add a content handling callback, e.g.:
$BBHandler = bbcode_create([
'abc'=> [ 'type' => BBCODE_TYPE_NOARG,
'open_tag'=>'<p>',
'close_tag'=>'</p>',
'content_handling' => function () { return "hello"; }
]
]);
echo bbcode_parse($BBHandler,"[abc][/abc] word"); //"Should" echo hello world
I am basing this on the PHP BBCode module