Hidding Output of an Included File

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Hidding Output of an Included File

Post by tecktalkcm0391 »

Is there someway to hide or not print the output of an include file? I have this already:

Code: Select all

print('<!--');
include("include.php");
print('-->');
Which still prints it output in the HTML but puts it in a comment. But I want to make it so that PHP doesn't even print/echo out anything so I can remove the to prints
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Whooaaa.... I was beginning to wonder if you actually existed or not :P Hello :)
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

OK i know how to use ob_start but not in this way, can someone explain how to do this or something... i'll keep reading and stuff but anyone that wants to help do so. THANKS!
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

The "surrounding" script starts a buffer.
The included script's output is put into this buffer.
The "surrounding" script
http://de2.php.net/obstart wrote:ob_end_clean() will silently discard the buffer contents.
Get's you nowhere if the included script flushes the buffer itself, but maybe it's sufficient.
d11wtq wrote:Whooaaa.... I was beginning to wonder if you actually existed or not
the time for the next incarnation has come.
So this makes me the third(?) volka? ;)
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Whoa....from out of nowhere, he returns!!

Welcome back :)
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

volka wrote:The "surrounding" script starts a buffer.
The included script's output is put into this buffer.
The "surrounding" script
http://de2.php.net/obstart wrote:ob_end_clean() will silently discard the buffer contents.
Get's you nowhere if the included script flushes the buffer itself, but maybe it's sufficient.
d11wtq wrote:Whooaaa.... I was beginning to wonder if you actually existed or not
the time for the next incarnation has come.
So this makes me the third(?) volka? ;)
Thanks! It worked.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

volka!! heya!
Post Reply