vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Including External HTML File in Template (https://vborg.vbsupport.ru/showthread.php?t=264034)

kirupa 05-22-2011 06:35 PM

Including External HTML File in Template
 
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/t..._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:
Code:

$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:
Code:

<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 06:52 PM

As part of debugging to see where the issue lies, try this:
PHP Code:

$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 07:11 PM

Hi Lynne,
Unfortunately, no - no output is displayed. I have ensured that Plugins are enabled.

Thanks,
Kirupa

Lynne 05-23-2011 12: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:
Code:

array('newHeader ' => $newHeader)
array('newHeader' => $newHeader)


kirupa 05-23-2011 05:18 AM

Lynne - you were right! The extra space was what did me in. I am kicking myself as we speak :P


All times are GMT. The time now is 07:21 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02399 seconds
  • Memory Usage 1,723KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete