PDA

View Full Version : Including External HTML File in Template


kirupa
05-22-2011, 07:35 PM
Hi everyone,
I'm running into a weird issue that I am not able to debug. I am trying to include an external HTML file in my header template. I've read the following posts that describe how to do this: http://www.vbulletin.com/docs/html/templates_externalfiles and https://vborg.vbsupport.ru/showthread.php?t=242454

The problem is that this doesn't seem to be working for me. Here is what I've done.

Created the new Plugin
The new plugin hook location is global_init_start, and the execution order is 5. The code I am using is:
$newHeader = implode('', file('../ssi/forums/defaultHeader2.shtml'));
vB_Template::preRegister('header',array('newHeader ' => $newHeader));

I've verified that this file exists. The forums live in http://www.kirupa.com/forum, and the file I am trying to include lives in: http://www.kirupa.com/ssi/forums/defaultHeader2.shtml

Referencing it in the Template
The next thing I do is go to the Styles Manager and make a reference to this plug-in:
<div class="above_body"> <!-- closing tag is in template navbar -->
{vb:raw newHeader}
<p>hello, world!</p>
<div id="header" class="floatcontainer doc_header">
When I save everything and test how this works on my board, nothing shows up.

Can someone please tell me what I am doing that may be wrong?

Thanks,
Kirupa :)

Lynne
05-22-2011, 07:52 PM
As part of debugging to see where the issue lies, try this:
$newHeader = implode('', file('../ssi/forums/defaultHeader2.shtml'));
$newHeader = "Hello World";
vB_Template::preRegister('header',array('newHeader ' => $newHeader));

Do you get any output now?

kirupa
05-22-2011, 08:11 PM
Hi Lynne,
Unfortunately, no - no output is displayed. I have ensured that Plugins are enabled.

Thanks,
Kirupa

Lynne
05-23-2011, 01:56 AM
OK, I just tried this myself. I assume you meant global_bootstrap_init_start instead of just global_init_start.

You're gonna kick yourself over this... you have an extra space in your call here - see yours, with what should be underneath:
array('newHeader ' => $newHeader)
array('newHeader' => $newHeader)

kirupa
05-23-2011, 06:18 AM
Lynne - you were right! The extra space was what did me in. I am kicking myself as we speak :P