PDA

View Full Version : Including custom PHP file and header / footer


konstance
08-22-2014, 05:33 PM
Hello!

I'm hoping someone has had this issue and was able to find a solution...

I just upgraded from vb 4 to vb 5 connect, and to my disappointment, I realized that the plugins system was no longer supported.

I had a plugin that included a PHP file that generated a user session from our main website, and then passed rendered HTML in a variable, that we simply included above the header. For example, this was my plugin code before:


include('/home/webapps/current/ext/forum_user_session.php');

// HEADER VARIABLES
vB_Template::preRegister('dt11_forum_header', array("new_header" => $new_header));
vB_Template::preRegister('dt11_footer', array("new_footer" => $new_footer));

// HEADER FOR FORUM
$dt09_forum_header = vB_Template::create('dt11_forum_header')->render();

// FOOTER FOR FORUM
$dt09_footer = vB_Template::create('dt11_footer')->render();
vB_Template::preRegister('footer', array("dt09_footer" => $dt09_footer));


where forum_user_session.php was setting $new_header and $new_footer variables (HTML code), that I would then simply include in a template.

Any way to make this work in vb 5 Connect?

thank you in advance!

Dead Eddie
08-22-2014, 09:37 PM
Build an API to expose the data that you need exposed, call the API within the template using {vb:data} calls, push that data to your custom templates from within the template.

Easy. :)

konstance
08-25-2014, 12:54 PM
In case someone is looking for a more helpful in-depth explanation, I found it here:
https://vborg.vbsupport.ru/showthread.php?t=302307