crashmaster Posted May 2, 2009 Share Posted May 2, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/156536-output-buffering/ Share on other sites More sharing options...
kenrbnsn Posted May 2, 2009 Share Posted May 2, 2009 And your question is? Ken Quote Link to comment https://forums.phpfreaks.com/topic/156536-output-buffering/#findComment-824233 Share on other sites More sharing options...
crashmaster Posted May 2, 2009 Author Share Posted May 2, 2009 Sry, I've posted post before finish it Quote Link to comment https://forums.phpfreaks.com/topic/156536-output-buffering/#findComment-824237 Share on other sites More sharing options...
crashmaster Posted May 2, 2009 Author Share Posted May 2, 2009 is it so difficult question ??? Quote Link to comment https://forums.phpfreaks.com/topic/156536-output-buffering/#findComment-824245 Share on other sites More sharing options...
crashmaster Posted May 2, 2009 Author Share Posted May 2, 2009 Hey.. I really need this... Quote Link to comment https://forums.phpfreaks.com/topic/156536-output-buffering/#findComment-824289 Share on other sites More sharing options...
kenrbnsn Posted May 2, 2009 Share Posted May 2, 2009 Why do you need output buffering? As long as you do the include before you output the <title></title> line, then all you have to do is either <title><?php echo $desc ?></title> or <?php echo "<title>$desc</title>"; ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/156536-output-buffering/#findComment-824310 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.