What I’m trying to do:
I have two files: One is the header.php which is included (by php include) into my second file content.php
I am going to be use my header.php with many different ‘content’ files, just so you know
Now, I have a div that is going to display a title text provided by content.php and any other pages that includes the header.php: <div class="title"> </div> This div is only in the header.php.
My problem is that I do not know how to include a text into the header.php div area <div class="title"> </div> from my content.php which again includes the header.php.
- Header.php (contains the
<div class="title"></div>) - Content.php (needs to have the title text and be included into the header.php
<div class="title"> <div>area)
My question is: How in heck can I do this with php?
And I am not very knowledgeable about php or any type of coding for that matter. I have just been winging it, now I’m rather stuck. So If anyone could possibly explain how to do this in a simplified way, I would really appreciate it.
A very basic simple system would work like this:
header.php:
content.php:
header.php would check for the presence of a “title” variable, and output it if need be. If there’s no title varaible, you get an empty div.
The content page is responsible for setting the title variable. And when the header page is included, it’ll be in the same “scope” as the content.php code, pick up the variable, and run with it.