vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Script not outputting anything (https://vborg.vbsupport.ru/showthread.php?t=72343)

M.Smith 11-30-2004 05:18 PM

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

Andreas 11-30-2004 06:07 PM

Do you have a template site_main in the style your are using?

M.Smith 11-30-2004 07:59 PM

Yeah, brad cleared it up for me on IRC. It was because of me using print_output() more than once. :)

It's working fine now so this can be closed.

thanks,
Martin


All times are GMT. The time now is 12:34 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.01279 seconds
  • Memory Usage 1,757KB
  • 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_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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