Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-05-2002, 12:17 PM
Rostor Rostor is offline
 
Join Date: Nov 2001
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I use this code for including header.php page in my vb.
PHP Code:
ob_start(); 
require("swzheader.php");
$header1 = ob_get_contents(); 
ob_end_clean(); 
Now I need to include another page swzfooter.php in my vb index, I try some code like this :

PHP Code:
ob_start(); 
require("swzheader.php");
ob_start(); 
require("swzfooter.php");
$footer1 = ob_get_contents();
ob_end_clean();
$header1 = ob_get_contents();
ob_end_clean(); 
but it doesn't works any idea ?
Reply With Quote
  #2  
Old 02-05-2002, 06:40 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 5 раз(а) в 1 сообщении
Default

PHP Code:
ob_start(); 
require("swzheader.php");
$header1 = ob_get_contents();
ob_clean();
require("swzfooter.php");
$footer1 = ob_get_contents();
ob_end_clean(); 
(using ob_clean() to clear the buffer before requiring another file...)
Reply With Quote
  #3  
Old 02-05-2002, 06:48 PM
Rostor Rostor is offline
 
Join Date: Nov 2001
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It gives me this error:

Fatal error: Call to undefined function: ob_clean() in C:\Inetpub\wwwroot\Forum\global.php(275) : eval()'d code on line 9

just a little more help plz ?
Reply With Quote
  #4  
Old 02-05-2002, 06:51 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 5 раз(а) в 1 сообщении
Default

Oh ok, I just noticed that function in not yet in tje PHP release. Sorry.

Use this:
PHP Code:
// get header
ob_start(); 
require("swzheader.php");
$header1 = ob_get_contents();
ob_end_clean();

// get footer
ob_start(); 
require("swzfooter.php");
$footer1 = ob_get_contents();
ob_end_clean(); 
Reply With Quote
  #5  
Old 02-05-2002, 07:26 PM
badr511 badr511 is offline
 
Join Date: Dec 2001
Location: asia
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

number 1 firefly :up:
Reply With Quote
  #6  
Old 02-05-2002, 09:55 PM
XiXora's Avatar
XiXora XiXora is offline
 
Join Date: Nov 2001
Location: Birmingham, UK
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

why do we have to use ob things?
Reply With Quote
  #7  
Old 02-06-2002, 06:29 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 5 раз(а) в 1 сообщении
Default

OB = Output Buffering.

Because when you include a file, what it outputs is also output on the including page, and we don't want that, because we want to USE what it output as a variable later in the templates.

So we use output control to 'capture' the output of that file and store it inside a variable.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:50 PM.


Powered by vBulletin® Version 3.9.0
Copyright ©2000 - 2017, vBulletin Solutions Inc.