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:
PHP 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]
- Example: [includetest="World!"]Hello![/includetest]
- Use {option}: Yes
Additionally, you need to create a
directory called custombbcodes, and in it create a
file called includetest.php with the following code:
PHP Code:
<?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>";
--------------------------------------------------------------------