include or require, but not display ??

Is it possible to include or require a php file so that you can use it to define variables, but then not display that file? I’ve got a page that includes a file in the middle of the page, but would like for it to refrence the included file immediately so that it can read the definition for variables from the included file, but not actually display the included file immediately - instead display it later in the page
does that make sense?

why don’t u just split that one file into two, one to define the variables and one to display what u need in the middle?

mainly because that would kind of defeat the purpose…that would mean two files for every page and would be double entry of the variables - especially since the site is already developed, it’d be extra work to re-do things

to hide the output u may use the output buffer:

Or are talking like functions?
like have include(‘functions.php’); at the top of the page.
Later on down in the script do calls to those functions. Yes that can be done.

I’ve been trying for WEEKS to figure that out…I’ve asked so many different people on so many different boards. That was soo easy - why didn’t anyone ever say that!!!


u sould have asked us earlyer :smiley:

i guess they haven’t thought of that. i hardly know anyone really using the output buffer (actually i never ever used it as well)

tis not really good coding to hide the output with the output buffer. but is works.

Sponsor our Newsletter | Privacy Policy | Terms of Service