html - PHP include without output? -


alright,

heres thing. have (paid for) shopping cart, in process of jazzing jquery , css , whatever else make , work nicer is.

anyway. in order use database , functions etc, need include file @ beginning of webpage. have put in a

<div style="display:none;"> 

but of course output still written browser. not alot, prefere have no div , no output, still want perform it's calculations. 5000 line php file , complicated go through , edit out bits dont want.

is there clever way, can include file specify if want written page when including it?

i knows it's bit of bodge, hope i've explained myself, if can please let me know.

thanks.

you can use output buffering catch output variable instead of sending browser:

ob_start(); require(...); $data = ob_get_clean(); 

note use of require instead of include. because think script should crash when hitting include error, not continue if nothing wrong.


Comments

Popular posts from this blog

All overlapping substrings matching a java regex -

c++ - Using OpenSSL in a multi-threaded application -

php - Deleting/Renaming a locked file -