Forum Moderators: coopster
In ASP, I would normally set up a site-specific includes folder in the site root, and use the following code:
<!--#include virtual="/includes/header.asp"-->
However, from what I gather, PHP requires that you set assign the path of your include folder to you include_path parameter in the php.ini
I've since learned that you assign multiple paths to this parameter.
However we host many sites on our server, and they will very likely all have includes named "header.php" and "footer.php" etc. So my question is can you tie a particular include_path to a particular site - or do I have to give all my includes unique names?
Many thanks in advance.
Ben
includes work much the same. You can set the include path specific to the site or to the server. You can tell PHP exactly where to find it or allow it to use the path in the php.ini directive. In this particular instance to include common HTML like that, one of the more common methods is to tell PHP right where it is, but use the DOCUMENT_ROOT to set the static path on the fly based on the site that is calling it.
<?php include [php.net] $_SERVER [php.net]['DOCUMENT_ROOT'] . '/includes/header.php';?>