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 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
  #2  
Old 11-30-2004, 06:07 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do you have a template site_main in the style your are using?
Reply With Quote
  #3  
Old 11-30-2004, 07:59 PM
M.Smith M.Smith is offline
 
Join Date: Feb 2002
Location: Durham, UK
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
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 12:41 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.04221 seconds
  • Memory Usage 2,222KB
  • Queries Executed 13 (?)
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
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)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_postinfo_query
  • fetch_postinfo
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete