Questions tagged [ob-start]

ob_start is a PHP function which turns output buffering on. While output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer.

190 questions
1
vote
4 answers

Whats the point of using ob_start without any parameters in PHP

I can see the use of ob_start with the output_callback parameter set but I can't see the use of ob_start when calling it without any parameters set at all. Whats the point of disabling output to later throw all the output at once? Doesn't this use…
AlexV
  • 22,658
  • 18
  • 85
  • 122
1
vote
1 answer

Include javascript files content in ob_start buffer

I am currently working on the translation of a website. To perform this translation easily, I created a .csv file containing the matches between the two languages (japanese->english). Then, this file is parsed with PHP, and ob_start() is called on…
1
vote
2 answers

Insert Values after Compiler has passed Line

To start, I am using PHP with ob_start() and ob_flush. In the code I have a part where parameters are suppose to be dynmacially loaded in the head of a file. //Enter…
user293313
  • 227
  • 1
  • 2
  • 10
1
vote
1 answer

How to use output buffering ob_start in cakephp?

I have been trying to implement caching via out buffers. I have used that approach in PHP but I am stuck as where to start buffering i.e. (1). where to put ob_start() in controller (2). How to send buffer data to views Thanks in advance
pnirwan
  • 87
  • 1
  • 10
1
vote
1 answer

PHP ob_start() for file caching

when this sample web page loads, it checks cached file from /cache folder. If there is no cached file, it calls ob_start() and creates a .html cache file. Problem is this caching process is working everytime even I have not called ob_start(). Please…
David U
  • 27
  • 4
1
vote
1 answer

ob_get_content() output incorrect

I'm experiencing some problems with ob_start function, probably due to the new PHP 5.5 What I'm trying to do is render some PHP from a third file using inside ob_start. Here the code: function fetch() { extract($this->a_vars); // Extract the…
1
vote
1 answer

ob_start including file echoing 1

class function (located php/php_includes/easyCMSv2.php) public function get_file($file){ ob_start(); include('php/'.$file); $file = ob_end_clean(); return $file; } stylesheet_config.php (located php/css)
EasyBB
  • 6,176
  • 9
  • 47
  • 77
1
vote
2 answers

Output streaming with PHP ob_start & ob_get_clean

I have a script that echo out content in a php script and resulting in a very large file, e.g. 100MB Currently I use the following way to capture the output and write to another file ob_start(); require_once 'dynamic_data.php'; // echo 100MB…
Ryan
  • 10,041
  • 27
  • 91
  • 156
1
vote
0 answers

shortcode displays at wrong place, always on the top

Iam working on a webshop thats going to display the cart before the checkout. like now it is the checkout before the cart. I cant get this to work. I got a problem that the plugin always shows on the top of the content. i fixed this a wihle ago. Now…
1
vote
1 answer

Return array from php ob_start instead of contents

If you need to return an array from php ob_start instead of contents how do you do this? If a return variable is defined I want the return value instead of the default contents output.
Dieter Gribnitz
  • 5,062
  • 2
  • 41
  • 38
1
vote
0 answers

How to maintain global variables when you use ob_start?

I have this problem during 1 week, I need to solve this. If I test this code, it works well:
1
vote
0 answers

How to save in php var an Javascript output

I have an cURL php output in a variable that contains the following code document.writeln('') document.writeln(' SOME TEXT ') document.writeln('10-04-2013') document.writeln('
Kargol
  • 113
  • 9
1
vote
0 answers

Echo'ing ob_start callback in external PHP file

I'm working on population static HTML with database information in PHP. The HTML files have a pattern ({{$pattern}}) which when located in an HTML file will be replaced with a matching PHP variable. An example HTML file could…
Andreas Jarbol
  • 745
  • 2
  • 11
  • 27
1
vote
2 answers

Variable accessibility with require_once/ob_start()

Maybe I'm just tired or just am simply confused, but I'm having a strange issue dealing with some require_once() calls and ob_start(). Basic Structure: Top of Main.php: require_once 'config.php'; // includes variable $A = "bar", and Function…
anson
  • 4,156
  • 2
  • 22
  • 30
1
vote
2 answers

is what i'm trying to do with ob_start() possible?

I'm new to php and trying to create a simple script.. but I don't know if what i'm trying to do is possible with ob_start() please let me know, thanks. here is my code:
Jnafo
  • 13
  • 2