I wrote this code in functions.php.
When I use now in the bbcode.html {code_media}, it is not accepted.
However, I would like to write the code in the bbcodev3.php. If I do that then causes but a white page.
function get_code_media() {
global $site_template;
$code_media = "";
if (@is_dir("./bbcodev3/addons/media")) {
$handle = @opendir("./bbcodev3/addons/media/");
while ($file = @readdir($handle)) {
if (get_file_extension($file) != "php") {
continue;
}
$plugin_file = file("./bbcodev3/addons/media/".$file);
$plugin_file[0] = trim($plugin_file[0]);
if (preg_match("/CODE:(.+)/", $plugin_file[0], $regs)) {
$code_media = trim($regs[1]);
}
}
@closedir($handle);
}
$site_template->register_vars("code_media", $code_media);
}I'm working on my Bbcode variant.
In the HTML files I have currently available that PHP code.
This is both unattractive and the second is not really suitable.
I just want to outsource only the PHP code and use it as a variable in the HTML files.