vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   External Files, need some help. (https://vborg.vbsupport.ru/showthread.php?t=156675)

Otikeu 08-31-2007 04:39 AM

External Files, need some help.
 
Hello,

I've used the guide for including external php files and it does work. There is only one issue that doesn't seem to work...

I've got $sitemenu to include a .html file. $sitemenu is defined within the php file that I added into a plugin (using that guide). Normally, I just used php code on my website, but of course it is different with vB. Since I can't do include php codes in the templates, I've tried something like:

PHP Code:

$sitemenu = include('/path/to/file.html'); 

However, it just gives a "1" where the variable is and outputs the raw data of the .html file to the top.

The plugin is hooked to global_start and the variable is being used the header. Is there a better way to have this work?

Dismounted 08-31-2007 11:23 AM

Have you followed that page exactly and used the PHP code provided (and change the path of course)?

Opserty 08-31-2007 01:02 PM

Just a guess but...

The link you gave give this code:
Code:

$includedhtml = implode('', file('path/to/this/file/myfile.html'));
For HTML files, you are using include

Otikeu 08-31-2007 09:31 PM

I have php working, I'm talking about the included html file in the in the php file I have connected to vBulletin using that guide.

As in, I have connected a external php file. however, the php file has a varialbe as seen above of which I want to be echoed onto vB.

Thanks.

Opserty 08-31-2007 10:17 PM

In which case you need to return the variable:

i.e. put return($sitemenu); after your include statment in the PHP file.

Source: http://www.php.net/include/#id2543347

Try that see if it works.


All times are GMT. The time now is 03:51 PM.

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.00966 seconds
  • Memory Usage 1,720KB
  • 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
  • (1)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