Is there a way to do simple server-side includes in a .php file similar to <!--#include virtual="header.txt" --> in .shtml?
Printable View
Is there a way to do simple server-side includes in a .php file similar to <!--#include virtual="header.txt" --> in .shtml?
include 'file.php';
or
require 'file.php';
In both cases it reads and executes the file, but include generates warnings in case of errors, whereas require generates fatal errors.
Well now, let's not get too simple. :p
Thanks, I'll try it out.
There is a difference between the two, although subtle...
include('file.txt') and require('file.txt') both include file.txt.
But if file.txt does not exist, require() will stop the php page execution, but include() only throws a warning and continues page execution.
Edit: oops, endless already said that...
I've tried both and see what you both mean.
Ahh, so simple yet so effective. This is exactly what I needed. Thanks a lot. :)