Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.