vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Getting trouble in making vbb powered custom page (https://vborg.vbsupport.ru/showthread.php?t=201452)

gtrts 01-11-2009 10:33 PM

Getting trouble in making vbb powered custom page
 
I did all the things follow to this thread:https://vborg.vbsupport.ru/showthread.php?t=62164

and i got a blank page,here is the code in test.php:
PHP Code:

<?php 

// ####################### SET PHP ENVIRONMENT ########################### 
error_reporting(E_ALL & ~E_NOTICE); 

// #################### DEFINE IMPORTANT CONSTANTS ####################### 
define('NO_REGISTER_GLOBALS'1); 
define('THIS_SCRIPT''test'); // change this depending on your filename 

// ################### PRE-CACHE TEMPLATES AND DATA ###################### 
// get special phrase groups 
$phrasegroups = array( 

); 

// get special data templates from the datastore 
$specialtemplates = array( 
     
); 

// pre-cache templates used by all actions 
$globaltemplates = array( 
    
'TEST'
); 

// pre-cache templates used by specific actions 
$actiontemplates = array( 

); 

// ######################### REQUIRE BACK-END ############################ 
require_once('./global.php'); 

// ####################################################################### 
// ######################## START MAIN SCRIPT ############################ 
// ####################################################################### 

$navbits = array(); 
$navbits[$parent] = 'Test Page'

$navbits construct_navbits($navbits); 
eval(
'$navbar = "' fetch_template('navbar') . '";'); 
eval(
'print_output("' fetch_template('TEST') . '");'); 
?>

here is the code in template "TEST"
HTML Code:

$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header

$navbar

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="tcat">Title</td>
</tr>
<tr>
        <td class="alt1">Text</td>
</tr>
</table>

$footer
</body>
</html>

the "TEST" template works fine in index.php,when I put
PHP Code:

eval('print_output("' fetch_template('TEST') . '");'); 

in it.It just wont work in test.php.

how can I solve this problem?:confused:

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

ps: vbb version is 3.8.0

Bellardia 01-11-2009 10:51 PM

Are you sure if the page has access to global.php?

Lynne 01-11-2009 10:59 PM

Is the page in the same directory as all the other vbulletin forum pages?

gtrts 01-11-2009 11:56 PM

yes,it's in the same path as index.php is.
I tried to rename test.php to index.php or other existing vbb files, it works. It seems vbb is preventing me to use custom file, is there a setting doing such stuff?(prevent using custom file)

Dismounted 01-12-2009 03:29 AM

You shouldn't need this line in the file (try removing it):
PHP Code:

define('NO_REGISTER_GLOBALS'1); 


gtrts 01-12-2009 04:18 AM

Quote:

Originally Posted by Dismounted (Post 1709251)
You shouldn't need this line in the file (try removing it):
PHP Code:

define('NO_REGISTER_GLOBALS'1); 


I removed it, but still got a blank page:confused:

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

I changed the last part of code FROM
PHP Code:

$navbits construct_navbits($navbits);  
eval(
'$navbar = "' fetch_template('navbar') . '";');  
eval(
'print_output("' fetch_template('TEST') . '");'); 

TO

PHP Code:

$navbits construct_navbits($navbits); 
eval(
'$navbar = "' fetch_template('navbar') . '";'); 
eval(
'$output = "' fetch_template('TEST') . '";'); 
echo 
$output;
//eval('print_output("' . fetch_template('TEST') . '");'); 

then the result shows exactly as what it should be. Anyone can tell me what is going on?:(

vbplusme 01-12-2009 05:27 AM

Seems I read somewhere that this code needs to be in all pages now?

PHP Code:

define('CSRF_PROTECTION'true); 


gtrts 01-12-2009 07:59 AM

Thanks bro. But, it doesn't help. I added that code, and still, a blank page.It seems I can't use print_output?

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

ok I tried to dig in the print_output function, and found the script stopped at fetch_gzipped_text()'s
PHP Code:

header('Content-Encoding: ' $encoding); 

,after this code the browser got unrecognized string instead of html codes,that's why IE6 returned a blank page and firefox returned an error message says the page is corrupted.

so anyone please help me :(

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

btw $encoding is "gzip"

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

when I save test.php in utf-8 without BOM, all trouble gone... anyone can tell me whta is BOM ?

Digital Jedi 01-12-2009 10:34 AM

Are you sure you're visiting the page in the style you created the template in? That's usually why you'll get a blank page.

leftie 01-15-2009 06:40 PM

I'm having this problem too, so i need a solution as well.
EDIT. I'm a fool.
I ftp'd the php file before i saved what i copied and pasted. All is well now.

kiril_cvetkov 01-15-2009 07:22 PM

The problem is with template "TEST"..
1)Double check does the template name is "TEST"
2)maybe you've opened test template on other skin... try to open template called "TEST" on the style that you are using

cheers :)

RS25com 01-19-2009 09:33 PM

I am having the exact same problem. I have added a template to my style called "products", added a file called products.php in the /forums folder, and then changed the file to reference "products" and I just get a blank page.

3.8.0 here...

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

Problem solved:

I was using an UPPER CASE template name in my php file. Once I changed it to lower-case, which matches the name of the template in the Styles admin it worked. :)


All times are GMT. The time now is 10:39 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.01747 seconds
  • Memory Usage 1,765KB
  • 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_html_printable
  • (8)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (12)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