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 07-21-2009, 05:04 AM
nirvana43's Avatar
nirvana43 nirvana43 is offline
 
Join Date: Oct 2007
Location: Pune, India
Posts: 361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default [SOLVED]Garbage text getting printed on top of every custom page

--------------------------------------------------------------------------------------------------------------------

PLEASE SCROLL DOWN AND SEE LAST REPLY

Update : Here is solution!
--------------------------------------------------------------------------------------------------------------------


Hello

Please check screen shot below :


I'm designing 1 mod for vb 3.7.3 and there is garbage text getting printed on top of every custom page i've designed for mod.
However i've gone through every bit of code i've written, for like zillion times. But i'm not able to figure out what possibly could be causing above garbage.

The thing is, i just wanna know what kinda possible conditions could cause above garbage??
like custom redirection? <if> <else> condition? etc. etc.

I've followed all vbulletin API rules while coding and also double checked.
So if someone evah faced above thing in life before then kindly let me know what was causing it.

P.S. I know its because of my mod so please tell me something beside disabling hooks & mods (already done that).. b'cuz i'm tryin to get rid of that garbage.
Reply With Quote
  #2  
Old 07-21-2009, 05:08 AM
R1lover's Avatar
R1lover R1lover is offline
 
Join Date: Apr 2006
Location: Northern Ca
Posts: 428
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very hard to tell, bad code it the issue though... without knowing what you changed its hard to tell though.
Reply With Quote
  #3  
Old 07-21-2009, 05:18 AM
nirvana43's Avatar
nirvana43 nirvana43 is offline
 
Join Date: Oct 2007
Location: Pune, India
Posts: 361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by R1lover View Post
Very hard to tell, bad code it the issue though... without knowing what you changed its hard to tell though.
I didn't changed anything directly in any vb file...
here is more detailed explanation on what exactly i've coded :

Lets say my file 1 contains :

Quote:
error_reporting(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'test');
$globaltemplates = array('test',);
require('./global.php');
include('test/test.php');
$navbits = array();
$navbits[$parent] = 'TEST';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
if (!$vbulletin->userinfo['userid'])
{
print_no_permission();
}
else
{
eval('print_output("' . fetch_template('test') . '");');
}

Now my test.php located at test/test.php does following :

Quote:
include(dirname(__FILE__)."/inc.php");
done=0;
$init==0;
initcond="$init==1";
if ($init==1)
{
$inmsg.="<center>$state<br /></center>";
}
else
{
/*
go on initializing php variables

For e.g. :
*/
$msg="some message";
$initialised_variable="<table class='tborder' align='center'><tr><td>$msg</td></tr></table>";

}

still editing...
My template test contains following code :
Quote:
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>TEST</title>
$headinclude
<script type='text/javascript'>
<!--
var checkCount=0
var maxChecks=$num
function setChecks(obj){
if(obj.checked){
checkCount=checkCount+1
}else{
checkCount=checkCount-1
}
if (checkCount>maxChecks){
obj.checked=false
checkCount=checkCount-1
alert('You have only $num left!')
}
}
//-->
</script>
<if condition="$adicondition">
<script language='Javascript'>
window.location='next.php'
</script>
<else />
</if>
</head>
<body>
$header
$navbar
<if condition="initcond">
$inmsg
<else/>
$initialised_variable
</if>
<br />
$footer
</body>
</html>
--------------- Added [DATE]1248171228[/DATE] at [TIME]1248171228[/TIME] ---------------

I fixed the problem somehow but still need lil clarification!

I reffered this tutorial to create my custom pages.
When i removed require_once('./global.php'); from my main file, it fixed the problem.
The mod seems to work fine without that file though.
Can somebody tell me, will it cause any future problems?
And why exactly global.php was required there?
If it was for checking whether user is logged in or not then after removing global.php, my mod is still keeping non logged in users out.
then why global.php was there?

My file contains following code now :
Code:
error_reporting(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'test'); 
$globaltemplates = array('test',);
//require('./global.php');
include('test/test.php');
$navbits = array();
$navbits[$parent] = 'TEST';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
if (!$vbulletin->userinfo['userid'])
{
print_no_permission();
} 
else
{
eval('print_output("' . fetch_template('test') . '");');
}
Reply With Quote
  #4  
Old 07-21-2009, 03:09 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In test.php you are including inc.php. What is in there? I would guess one of the other files getting included somewhere in your page is including global.php already.
Reply With Quote
  #5  
Old 07-21-2009, 11:53 PM
Antivirus's Avatar
Antivirus Antivirus is offline
 
Join Date: Sep 2004
Location: Black Lagoon
Posts: 1,090
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think Lynne may be correct, IIRC this happened to be a couple months ago when i accidentally included global.php twice
Reply With Quote
  #6  
Old 07-22-2009, 11:51 AM
nirvana43's Avatar
nirvana43 nirvana43 is offline
 
Join Date: Oct 2007
Location: Pune, India
Posts: 361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thats gr8 help guyes!!! now i understood where i'm missing it..
I did included global.php many times!!
Thanks a million again for gr8 help!!! i will fix it tomorrow morning and will let you know guyes..
thanks!
Reply With Quote
  #7  
Old 07-27-2009, 02:06 AM
nirvana43's Avatar
nirvana43 nirvana43 is offline
 
Join Date: Oct 2007
Location: Pune, India
Posts: 361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Still not solved yet...
I tried everything... And now i think its not due to global.php getting called multiple times.

I turned on debug mode to see what files are getting called...
Here is debug information of page with garbage :


Here is debug information of page without garbage :


Why does it saying uncached template: orkut on garbage page and there is only php_sapi_name(): cgi-fcgi on page without garbage?????
Is that the cause of problem?

My template orkut contains following code :
Code:
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>Orkut Contacts Inviter</title>
$headinclude
</head>
<body>
<if condition="$adicondition">
<script language='Javascript'>
window.location='next.php'
</script>
<else />
</if>
$header
$navbar
<if condition="$adiinitcond">
$inviterplugs
<else/>
$contents
</if>
<br />
$footer
</body>
</html>
I tried removing java scripts from <head> section and it also didn't worked.

My orkut.php custom page contains following code :
Code:
require_once('global.php');
include('adiinviter/orkut.php');
error_reporting(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'orkut'); // change this depending on your filename

$globaltemplates = array('orkut');
$navbits = array();
$navbits[$parent] = 'Orkut Contacts Importer';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
if (!$vbulletin->userinfo['userid'])
{
print_no_permission();
} 
else
{
eval('print_output("' . fetch_template('orkut') . '");');
}
?>
I tried commenting "include('adiinviter/orkut.php');" and writing $contents="test"; but it also didn't worked.

somebody please help me with this issue...
Reply With Quote
  #8  
Old 07-27-2009, 02:17 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try following this article in creating your custom page - [How-To] vBulletin API Basics: Creating Custom Pages & Misc.. You have things in a different order - global called before some variables are defined. I had noticed before on my own pages that I had problems when I didn't include all the different pre-cached template groups and data arrays, even though they were empty.
Reply With Quote
  #9  
Old 07-27-2009, 02:26 AM
nirvana43's Avatar
nirvana43 nirvana43 is offline
 
Join Date: Oct 2007
Location: Pune, India
Posts: 361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
Try following this article in creating your custom page - [How-To] vBulletin API Basics: Creating Custom Pages & Misc.. You have things in a different order - global called before some variables are defined. I had noticed before on my own pages that I had problems when I didn't include all the different pre-cached template groups and data arrays, even though they were empty.
Ohhh...
how do i change order in which templates are getting called?? I mean can you tell me where do i need to change exactly??? like in template? or in custom page code i've posted above?
because code order in both pages i've posted above is same...

I need to call my main template in vbulletin i.e. orkut rite before :
# navbar
# navbar_link
# navbar_notifications_menubit

and just after
# footer

thnaks a lot for noticing.... i followed API docs thread only while designing custom pages
Reply With Quote
  #10  
Old 07-27-2009, 02:36 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 talking about the order of the templates, I'm talking about how you call global.php before you define some variables that are needed in global.php (like THIS_SCRIPT and error_reporting, etc.).
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 08:42 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.07246 seconds
  • Memory Usage 2,272KB
  • Queries Executed 11 (?)
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
  • (3)bbcode_code
  • (5)bbcode_quote
  • (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