Jump to content

OUTPUT BUFFERING


crashmaster

Recommended Posts

Hi there,

 

I am not an amateur in PHP, but 1 thing I can't understand is output buffer. I've read a few tutorials, but I can't understand 1 thing.

 

I need to understand this (will explain in example):

 

For example I have an index page, where is <title>Hello, it's index page</title>

Index page uses this code to include content:

 

index.php

$page = strip_tags($_GET['page']);

if (file_exists('pages/'.$page.'.php')) {
   include('pages/'.$page.'.php');
} else {
   include('pages/404.php');
}

 

When I set address to index.php?page=video&video_id=10 script video.php is included in index.php. For example, every video has it's own "description", which I get from database, by mysql_query in video.php

 

video.php

$id = intval($_GET['video_id']);
$desc = mysql_result(mysql_query("SELECT description FROM videos WHERE id=$id LIMIT 1"),0,0);

 

One thing I cannt understand is, how to put $desc from video.php to <title></title> of index.php by using output buffer. Can anybody help me?

Link to comment
https://forums.phpfreaks.com/topic/156536-output-buffering/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.