vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Strange Problem with ob_start(); (https://vborg.vbsupport.ru/showthread.php?t=62895)

Ian Cunningham 03-24-2004 08:10 PM

Strange Problem with ob_start();
 
I have added the following lines to my phpinclude template in VB3.0.0:

PHP Code:

ob_start();
require(
"sidepoll.php");
$sidepoll ob_get_contents();
ob_end_clean(); 

I have also got a php file called sidepoll.php in the same dir, which is a modified showthread.php.

If I try and place $sidepoll in the footer template, as I want this to appear on every page, I get a very strange problem... the page appears as if it is only sidepoll.php. None of the rest of the page is displayed, ONLY sidepoll.php.

Any ideas why it might be doing this? It is driving me crazy!

Dean C 03-25-2004 11:48 AM

I haven't played too much with PHP's output buffering but what are you getting the contents of? Don't you have to pass an arguement to the ob_get_contents function :)?

Ian Cunningham 03-25-2004 02:56 PM

I'm afraid you've lost me there mate :)

I thought that this would grab the parsed output of the sidepoll.php file, and then store that in place of the $sidepoll variable? i.e then I can echo the $sidepoll at a later stage?

Dean C 03-25-2004 03:45 PM

Oh right - well I didn't know that was how it works ;) You've lost me too :)

Btw your signature is in violation with our rules. Please refer to here:

[nosig]The prices and ads link is commercial.[/nosig]

Ian Cunningham 03-25-2004 03:55 PM

OK, sorry there :)

I'll change it now!

I have just managed to get the script working by modifying the actual sidepoll.php itself, it turns out the problem was in there :)

Dean C 03-25-2004 04:01 PM

Ok glad you resolved your problem - your sig's fine now :)

Ian Cunningham 03-25-2004 04:18 PM

Hmm, there is one problem I am having with the script though, I dont know how to select the latest poll thread from a particular forum.

I want the threadid of the latest poll in forumid x. I have tried this, but I know it isnt quite right, any chance you can spot what is wrong? (I am a PHP novice!):

PHP Code:

$threadid mysql_query("SELECT threadid FROM thread WHERE pollid >1 AND forumid = 2 ORDER BY date DESC 1"); 



All times are GMT. The time now is 11:06 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.02172 seconds
  • Memory Usage 1,720KB
  • 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
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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