Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-21-2009, 07:17 PM
tomcat59 tomcat59 is offline
 
Join Date: Dec 2002
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Including global.php renders html tags?

I suspect this is probably a server/php config issue.. any ideas welcome.

I am including the vbulletin 3.8.3 forums/global.php file in my index.php file as follows:

$curdir = getcwd();
chdir('./forums');
require_once('global.php);
...

I get the following message on my browser screen:
"Unable to add cookies, header already sent."
"File: path_to_my/index.php"
"Line: 9"

Looking at the page source, I see that the head and title tags are rendered per the inclusion of global.php. The above error is occurring since these tags were already used previously in the page.

<html xmlns="http://www.w3.org/1999/xhtml" dir="" lang="">
<head>

<title>My Community Forums</title>
</head>

The host server is Apache 1.3 with php 5.2. I don't have the above problem with Apache 2.x and php 4.2. I am using the same browser for both hosts.
Any ideas?
Reply With Quote
  #2  
Old 08-21-2009, 08:48 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to include the global.php file before you do anything html related on the page or you will get that error.
Reply With Quote
  #3  
Old 08-21-2009, 09:03 PM
tomcat59 tomcat59 is offline
 
Join Date: Dec 2002
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, I'll try that, but this doesn't explain why the behavior is different among server or php installations. Including this particular file should not render anything html, but apparently this assumption is wrong...
Reply With Quote
  #4  
Old 08-21-2009, 09:19 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Maybe you just aren't seeing the errors on one of the servers. Check your error_logs and see if they are in there.
Reply With Quote
  #5  
Old 08-22-2009, 12:48 AM
tomcat59 tomcat59 is offline
 
Join Date: Dec 2002
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, I made the change you suggested and it was much worse. I am now basically getting the entire forum home page rendered on the browser -- this is not what I expected.
So here's the deal.. I'm simply trying to retrieve vb user info for a non-vb page on my site. I need access to vbulletin global.php to accomplish this, or at least the old thread below led me to believe this would work. It did seem to work fine for a newer version of apache and php, regardless of where I included globals.php. Is there a different method I should used for 3.8, or do I have a configuration problem? I'd like to avoid passing command line arguements.

https://vborg.vbsupport.ru/showthrea...ssing+userinfo
Reply With Quote
  #6  
Old 08-22-2009, 12:55 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So this is a page you're writing? Perhaps you should post up your code and the template and we can see what is going on.
Reply With Quote
  #7  
Old 08-23-2009, 03:19 AM
tomcat59 tomcat59 is offline
 
Join Date: Dec 2002
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes, it is my docroot splash page (index.php). It seems that including global.php in a page that is hyper linked from a forum page works fine. If you try to include it anywhere else, stange things happen. I assume the vbulletin forum has configured something that effects the page rendering when including global.php (and it's includes) elsewhere. So, until someone has a solution for obtaining loged in user information in pages outside the forum, or until I can investigate further, I will refrain from including globals in those pages.

I think your original suggestion of placing the include ahead of the html is still valid. Thanks for the help!
Reply With Quote
  #8  
Old 08-23-2009, 03:21 AM
toonysnn toonysnn is offline
 
Join Date: Sep 2006
Location: Texas
Posts: 511
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Change the require for global to this:
PHP Code:
@require_once('./global.php'); 
Much handier.
Reply With Quote
  #9  
Old 08-23-2009, 03:25 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not understanding what you think the problem is. I have an index.php page that is outside of my vbulletin /forums directory and you can login on it and it works just fine.
Reply With Quote
  #10  
Old 08-23-2009, 03:37 AM
toonysnn toonysnn is offline
 
Join Date: Sep 2006
Location: Texas
Posts: 511
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes but, when using this format, sometimes there's an extra HTML code outputted by requiring the global.php file. By adding an at (@) symbol before the php code, it removes any output returned.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:39 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.03871 seconds
  • Memory Usage 2,248KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete