Jump to content

Any way to include but not display?


brandonjp

Recommended Posts

I've got an index.php file as follows:

 

hard-coded header

include(itempage.php)

hard-coded footer

 

BUT... the itempage.php has a couple defined variables that I'd like to use in the index.php file

 

I can add include() or require() before the header, but it displays the content of the included file

 

Is there a way to include, or require or reference a file so it will define the variables right away, but then display the actual contents of the file further down the page.

 

--bp

Link to comment
Share on other sites

define the variables on another config.php file. Then include that when you want the variables, and itempage.php when you want the output.

Another option is to make all of the output part of a function, and only call the function when you want it to print.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.