0
votes

I'm managing a PHP-built site that uses a multi-tier Smarty templating system, with a main template including sub-templates, etc. The site itself has dynamic features of its own, including user profile displayed in the header, footer sitemap and menu dropdowns dependent on user access levels, etc.

I now need to put a vBulletin forum in the middle of it all.

One of my options is, of course, making vBulletin "look like" the site, with a plugin for a header and footer - but that is pretty much out of the question, as some of the site's features should override forum access entirely (maintenance periods, user access restrictions, occasional "splash page" redirections), we have JavaScripts and header bits, and then there's the part about whole-site templates I mentioned. Large bits of page code would need to be duplicated and that's something I'd really rather avoid.

So I went the other way and started including the forum's files through a "wrapper" PHP script, hoping to capture its output entirely in an output buffer, and put it into my template proper. I even simulated REQUEST_URIs and other $_SERVER fields, to make the forum think it's being run standalone. It fought me back fiercely, breaking out of ob_start()s and die()ing instead of returning at certain points, so much that I went back to the drawing board.

My other option is to hack my own site in a gruesome way, to provide a severed header and footer the forum would use - but then there'd be the bits and scripts to combine. Also I'd lose the ability to produce one page in one run, and having one-time generated content synchronized between the header and footer would become a nightmare.

What other options do I have? Do all the sites using vBulletin stick to simple headers and footers, or is there something obvious I'm missing?

Update: What would completely solve my problem would be if vB supported a "template wrapper" plugin, called with all of the forum's generated HTML buffered as a parameter; "here's the output, go ahead and do whatever the hell you want with it". But is there support for that? Or is it feasible to hack it in?

1
Don't mix the two sites, keep them completely separate and deploy vbulletin standalone on a subdomain. (This also gives you the added benefit of opting to utilize their cloud hosting.) - Alex Howansky
That's out of the question. The forum needs to be integrated, not standalone. - Sinus the Tentacular
Define integrated. - Alex Howansky
I never like doing this but have you considered using (i)frames? - user10226920
@AlexHowansky Integrated, as in: looking and functioning exactly as part of the site, not as a separate feature. For example the logged-in user's name and avatar is handled as part of the core site, and needs to remain so. Cloud hosting would completely disable that. - Sinus the Tentacular

1 Answers

0
votes

After some searching, I found that vBulletin 5 happens to have a hookFrontendBeforeOutput hook, which can operate on the entirety of the output produced by vBulletin's template rendering. I can thus create a plugin which will capture vB's output, correct it where needed, and feed it into my own template system for a final presentation - as well as fire the site's login and other logic mechanisms.

This forum thread has an example, demonstrating that very hook, albeit in a much simpler case.