Reputation: 411
I am making a template for other pages to use. The source files that contains the include command are on different levels of directory. For example...
templates are help in:
/template/
pages are located in:
/services/
and:
/services/products/
and:
/services/products/dishwasher
So the statement I wrote was:
include (__DIR__ . "/../template/header.php");
I am testing locally is this an issue?
This only allows for /services/ to include the requested file, the lower sub domains do not get it. I also have the problem for pictures and css js files. Is there a work around?
Upvotes: 0
Views: 46
Reputation: 14345
You can call an include file on any page, at any level in the hierarchy, with something like this:
<?php include $_SERVER["DOCUMENT_ROOT"] . "/template/header.php"; ?>
… where /template/header.php
is the full path from the root folder to your header.php
file.
Upvotes: 3