View Single Post
  #1  
Old 11-30-2004, 05:18 PM
M.Smith M.Smith is offline
 
Join Date: Feb 2002
Location: Durham, UK
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Script not outputting anything

I've been trying to make a page that uses the vB templates based on something that I think Zachery posted (can't remember who) but it doesn't ouput anything to the browser at all. Can someone take a look at it and suggest why it might not be working. I have checked that all the database tables are there and properly populated.

PHP Code:
<?php
// ## Config
$errorPages['pagenf'] = 2// page id of your page not found error
$_GET['styleid'] = 13;
// ## Changes Directory so it can accesss vBulletin IF we are outside the forums folder, if not this is not nessary ##
chdir("./forum");

// ## Error Reporting ( we use error reporting in php so we can control the display of error messages
// ## we will use this because all vBulletin files follow the same error reporting rules) ##
//error_reporting(E_ALL & ~E_NOTICE);

// ## this here defines the "this_script" function, which if you use template conditionals, it will come in handy :) ##
define('THIS_SCRIPT''website');

// ## this action here cache's the templates so that everytime their needed a querry wont be needed to run
// ## the names in there are just the template names :), there must be a comma after everyone but the last ##
$globaltemplates = array(
'site_main',
'site_header',
'site_footer',
'site_nav_cat',
'site_nav_item'
);

// ## Grabs global.php this grabs vbulletins global.php so we can use the most basic of vBulletins functions ##
require_once("./global.php");
if (!
$DB_site) echo 'no db object'// Nope won't print that

// ## Sort $PATH_INFO into usable vars
if (isset($PATH_INFO)) {
        
$vars explode('/'$PATH_INFO);
        
$numVars count($vars);

        if (
$numVars == 0) {
            
$vars[] = '';
            
$numVars++;
        }

        for (
$i 1$i $numVars$i +=2) {
            
$qsVars[$vars[$i]] = $vars[$i+1];
        }


// ## Decide which page to display
if (is_numeric($qsVars['page'])) {
    
$pageid $qsVars['page'];
}
else {
    
$pageid 1;
}
$pageInfo $DB_site->query_first('SELECT * FROM site_pages WHERE pageid="' $pageid '"');
if (!
$pageInfo['viewable']) {
    
// If the query gave no result or the page is not viewable send out the page not found error
    
$pageid $errorPages['pagenf'];
}

$content $pageInfo['content'];
$pagetitle $pageInfo['pagename'];


// ## Generate navigation
$result $DB_site->query('SELECT * FROM site_navigation WHERE viewable = 1');

while (
$item $DB_site->fetch_array($result)) {
    if (
$item['iscat'] == 1) {
        
$category[$item['order']] = $item['name'];
    }
    else {
        
$object[$item['parent']][$item['order']] = $item['url'] . '||' $item['name'];
    }
}

foreach (
$category as $key => $value) {
    
$objectCount[$key] = count($object[$key]);
}

$catCount count($category);

ob_start();
for (
$i=1$i <= $catCount$i++) {
    
$catname $category[$i];
    eval(
'print_output("' fetch_template('site_nav_cat') . '");');
    
    for (
$j=1$j <= $objectCount[$i]; $j++) {
        
$obj explode('||'$object[$i][$j]);
        
$navurl $obj[0];
        
$navname $obj[1];
        eval(
'print_output("' fetch_template('site_nav_item') . '");');
    }
}
$navigation ob_get_contents();
ob_end_flush();

// ## ok this next set of lines "eval"'s our templates so they can be called inside the template we will print out ##
eval('$header = "' fetch_template('site_header') . '";');
eval(
'$footer = "' fetch_template('site_small') . '";');

// ## this calls to print out one main template ##
eval('print_output("' fetch_template('site_main') . '");');

echo 
'damn'// it won't even echo this
?>
I'm thinking it might be me using output buffering but in the php manual it says you can use it inside another one...

Thanks,
Martin
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01246 seconds
  • Memory Usage 1,828KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete