• To Download from our Community You will need to Purchase a Membership Upgrade
    Also make sure you like the Post or Resource before you try to Download

Resource icon

Cel PHP in Custom BBCode 09/28/2017

No permission to download
vB Version: 3.8.x

This addon allows for PHP-Code to be used in Custom BBCodes

It offers a framework for the easy integration and sharing of custom BBCodes that are based on PHP processing of the data entered by the user. It could, for example, be used to develop BBCodes that work with multiple options or to poll database information. It does allow for the Admin to use PHP in the Backend - it does, of course, not allow this to forum visitors.

You need to know PHP to use this Addon to develop your own PHP based bbcodes, however it would be possible to share them as an extension to this addon.



Installation:
- install the product file - done.

Using PHP in Custom BBCodes:
Create your Custom BBCode as always, and just put your PHP into the Replacement box (where the HTML used to go).
Just remember two things:
  • Your code needs to start with <?php
  • You need to return the result of your code.
If you're unsure what that means, read the php manual on eval() and look at the evaltest example in the second post.

For coders: include instead of eval
If you'd rather store the PHP for your new BBCodes in the file system for ease of development, that's possible, too:
  • create a folder called "custombbcodes" in your forum root
  • in that folder, create a php file that copies your BBCode Tag Name (ie. if your tag name is "includetest", the file needs to be called "includetest.php"). That's where your PHP goes.
  • in the Replacement box in the Custom BBCode Dialog, just put the word "include", nothing else
  • Since there's no eval() here, no need to return the result. Instead, it needs to go into $parsed.There's also an includetest example in the second post.
PHP BBCode Examples:

To test them, go to AdminCP->Custom BB Codes->Add new BB Code and fill in the form:


  • Title: evaltest
  • BBCode Tag Name: evaltest
  • Replacement:
Code:
 <?php
/*
Please note:
 
- available variables:
    param => $value, option => $option
    remember: [bbcode=option]param[/bbcode]

- pass your result via return (as needed for PHP eval)
    so end your code with return $my_result */

$my_result = "Test per eval (here no option was used):  ";
$my_result .= "Parameter: <strong>" . $value . "</strong>";

return $my_result; ?>

  • Example: [evaltest]Hello World![/evaltest]
  • Use {option}: No

  • Title: includetest
  • BBCode Tag Name: includetest
  • Replacement:
Code:
include[code]
[LIST]
[*]Example: [includetest="World!"]Hello![/includetest]
[*]Use {option}: Yes
[/LIST]
[U]Additionally[/U], you need to create a [U]directory called custombbcodes[/U], and in it create a [U]file called includetest.php[/U] with the following code:

[CODE][COLOR=#000000] [/COLOR]<?php
    /*
Please note:
  
- available variables:
    param => $value, option => $option
    remember: [bbcode=option]param[/bbcode]
- all output needs to go to $parsed
    no return statement needed (different from direct eval method)
    so don't use echo "Hello World", but $parsed = "Hello World"
*/

$parsed = "Test per include (here option was used): ";
$parsed .= "Parameter = <strong>" . $value . "</strong>, ";
$parsed .= "Option = <strong>" . $option . "</strong>"; [COLOR=#000000][/COLOR]
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.
Author
rE-BoOt
Downloads
0
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from rE-BoOt

Top