Tech Support Guy banner
Status
Not open for further replies.
1 - 5 of 5 Posts

·
Registered
Joined
·
136 Posts
Discussion Starter · #1 ·
Before I say anything I just want to point out that I have no working knowledge of PHP besides cutting and pasting. So everything in english would be nice.

I have a website that is built with php includes. In each page there is some php code that tells what the title for that page should be. Like below:

PHP:
<?php
$title = "This is the page title";
include("header.php");
?>
And in the header.php file in between the title tags is "$title".

Now, everything works how its supposed to work, except on one of my pages that is in another folder. The php include works fine, but the title I specify for the page doesn't show up.

What could be the problem? If you need anymore info let me know.

Heres a little chart of the layout of my site:

Root:

Header.php
Footer.php
Index.php
Page1.php
Page2.php

Folder:

ProblemPage.php
 

·
Registered
Joined
·
3,012 Posts
for the file in the new folder, instead of include("header.php"); try this include("../header.php");

so like this:

PHP:
<?php
$title = "This is the page title";
include("../header.php");
?>
 

·
Registered
Joined
·
6,052 Posts
for future reference, in php includes all paths are brought up, a dumb concept really. If you include ./folder/file.php in ./index.php, and have
in the file, it won't work, it has to be src="folder/img.jpg".
 
1 - 5 of 5 Posts
Status
Not open for further replies.
Top