Bestrafung
06-28-2018, 04:32 PM
I'm trying to include a php file in one of the templates for Bananalive's vbTournaments mod but have run into trouble. It's been a while since I've attempted something like this so I followed this guide: Including External Files (https://www.vbulletin.com/docs/html/templates_externalfiles) but it still isn't working. If anyone could let me know what I'm doing wrong I'd greatly appreciate it.
/example.php contents:
<?php
echo "Hello World!";
?>
I have real content but I scaled back to hello world for simplicity while testing.
Plugin:
Product: vB Tournaments, Ladders and Leagues Manager
Hook Location: global_start
Title: Example Block
Exec Order: 5
Code:
ob_start();
include 'example.php';
$myincludedphp = ob_get_contents();
ob_end_clean();
//vB_Template::preRegister('tmnt_index_c',array('myi ncludedphp ' => $myincludedphp));
I tried both include and require_once and I've tried both with and without the preRegister
Edit: I forgot to mention that I added {vb:raw myincludedphp} to the tmnt_index_c template, and I tested plain text in the same spot to ensure I was outside an if/else statement.
--------------- Added 1530212690 at 1530212690 ---------------
Update: I still need to test my real code but I found the issue... a simple space. The code example from the manual contains an extra space in the preRegister that I didn't catch when substituting my variable name.
/example.php contents:
<?php
echo "Hello World!";
?>
I have real content but I scaled back to hello world for simplicity while testing.
Plugin:
Product: vB Tournaments, Ladders and Leagues Manager
Hook Location: global_start
Title: Example Block
Exec Order: 5
Code:
ob_start();
include 'example.php';
$myincludedphp = ob_get_contents();
ob_end_clean();
//vB_Template::preRegister('tmnt_index_c',array('myi ncludedphp ' => $myincludedphp));
I tried both include and require_once and I've tried both with and without the preRegister
Edit: I forgot to mention that I added {vb:raw myincludedphp} to the tmnt_index_c template, and I tested plain text in the same spot to ensure I was outside an if/else statement.
--------------- Added 1530212690 at 1530212690 ---------------
Update: I still need to test my real code but I found the issue... a simple space. The code example from the manual contains an extra space in the preRegister that I didn't catch when substituting my variable name.