vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   [SOLVED]Garbage text getting printed on top of every custom page (https://vborg.vbsupport.ru/showthread.php?t=219072)

nirvana43 07-21-2009 05:04 AM

[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 :
http://img243.imageshack.us/img243/4039/sssssl.jpg

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. :(

R1lover 07-21-2009 05:08 AM

Very hard to tell, bad code it the issue though... without knowing what you changed its hard to tell though.

nirvana43 07-21-2009 05:18 AM

Quote:

Originally Posted by R1lover (Post 1852663)
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. :confused:
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') . '");');
}


Lynne 07-21-2009 03:09 PM

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.

Antivirus 07-21-2009 11:53 PM

I think Lynne may be correct, IIRC this happened to be a couple months ago when i accidentally included global.php twice

nirvana43 07-22-2009 11:51 AM

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! :)

nirvana43 07-27-2009 02:06 AM

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

I turned on debug mode to see what files are getting called...
Here is debug information of page with garbage :
http://img182.imageshack.us/img182/7580/14572635.jpg

Here is debug information of page without garbage :
http://img154.imageshack.us/img154/5880/52205182.jpg

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... :confused:

Lynne 07-27-2009 02:17 AM

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.

nirvana43 07-27-2009 02:26 AM

Quote:

Originally Posted by Lynne (Post 1856236)
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

Lynne 07-27-2009 02:36 AM

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.).


All times are GMT. The time now is 06:56 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.01136 seconds
  • Memory Usage 1,761KB
  • 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
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete