2012-02-23, 11:56 AM
This user has been denied support.
Hi, this is my first post here in mybb community. I'm also developing my first mybb plugin so I need help hehe.I have been using phpbb3 for years and I'm still learning how mybb plugins work, so, this is probably a noob question:
how can I add a lot of html/js lines of code before </body>?
A lot means: I don't want to do this:
$plugins->add_hook("pre_output_page","addMyHtmlAndJs");
function addMyHtmlAndJs($page){
global $mybb;
if ($mybb->settings['enabled_mypluginname'] == 1){
$aLotOfHtml = 'You know, a lot of HTML, with \' and more \' and fucking hard to edit...';
$page = str_replace('</body>', $aLotOfHtml . '</body>', $page);
}
return $page;
}
It works, but it is really hard to modify and I'm sure there is a better way of including html in a template. Something like:$page = str_replace('</body>', include('my_template_name') . '</body>', $page);
The plugin is a Node.js chat for myBB. Similar to facebook chat, with a general chat room too, and with Node.js instead of long polling. It works, but now it needs css, images, mybb integration, permissions, etc etc etc
Thanks for the help!