user3375577
user3375577

Reputation:

How to load header and footer .html dynamicaly

I am trying to include a header and footer dynamically with an url like this:

<?php include("http://www.monsite.com/layout/header.html"); ?>

but it doesn't work.

Anybody can help me ?

Thanks you.

Upvotes: 1

Views: 1150

Answers (2)

Syed Muneeb Ul Hasan
Syed Muneeb Ul Hasan

Reputation: 231

Make sure that the path you added in include function is correct.I think you are doing mistake in path of header file.

<?php include("root/path/layout/header.html"); ?>

Upvotes: 0

John Conde
John Conde

Reputation: 219794

include() expects a physical path on the file server, not a URL.

Files are included based on the file path given or, if none is given, the include_path specified. If the file isn't found in the include_path, include will finally check in the calling script's own directory and the current working directory before failing.

<?php include("/root/path/to/layout/header.html"); ?>

Upvotes: 3

Related Questions