vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   How to include HTML file (https://vborg.vbsupport.ru/showthread.php?t=265872)

snowname 06-27-2011 04:17 PM

How to include HTML file
 
In 3.x version, I can add a plugin. $test=implode (file, dir).

Then add $test in a template.

How to do this in 4.x version?

kh99 06-27-2011 04:29 PM

You can pre-register the variable in the template where you will use it, like this:

Code:

vB_Template::preRegister('template_name', array('test' => $test));

and then of course you'd use one of

HTML Code:

{vb:raw test} or
{vb:var test}

in the template.

snowname 06-28-2011 12:40 AM

I pre-registered:

Code:

$include_defaultpage = implode('', file('/bbs/CCED/float/default.html'));

vB_Template::preRegister('footer',array('include_defaultpage' => $include_defaultpage));

and hooked it at global start


I put {vb:raw include_defaultpage} into the footer template.

However, it does not work.

kh99 06-28-2011 01:10 AM

I tried what you posted above, except that I just used $include_defaultpage = "Foo"; as a test, and it showed up in my footer. Are you sure you're looking at the style with the edited footer? Otherwise, maybe it's not finding your html file?

Edit: also, are you sure you set the plugin to active? I've been known to forget that occasionally.

snowname 06-28-2011 01:51 AM

I also tried $include_defaultpage = "Foo";, It still does not show up.

--------------- Added [DATE]1309229656[/DATE] at [TIME]1309229656[/TIME] ---------------

Here is how I write:

Code:


Plugin PHP Code
$include_defaultpage = implode('', file('/bbs/CCED/float/default.html'));
$include_defaultpage = "test";
vB_Template::preRegister('FOOTER',array('include_defaultpage' => $include_defaultpage));


kh99 06-28-2011 01:58 AM

'footer' needs to be lower case. You had it that way before so I guess you probably were trying things.

snowname 06-28-2011 01:59 AM

I just did a test. If I put this plugin in header template. It works.

vB_Template::preRegister('header',array('include_d efaultpage' => $include_defaultpage));

--------------- Added [DATE]1309230334[/DATE] at [TIME]1309230334[/TIME] ---------------

it works now.

I changed /bbs/CCED/float/default.html to CCED/float/default.html

You are right. It did not find the file.

Thanks.


All times are GMT. The time now is 03:55 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.01088 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_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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