You use the full URL as you add the path that PHP tells you to try to execute an HTTP request to retrieve this file. This is NOT how you do it. If this ...100/index.php does not output PHP code, you will get some kind of HTML or something as the result of the include, not the php code in the file. Remember - you are retrieving the URL, which means it is an HTTP request, which means that the web server will EXECUTE this script and deliver its output, and not just execute its source code.
The web server cannot say that the HTTP request for this script is an include call from another PHP script on the same server. It would also be easy to request this script from some hacker hiding in Russia who wants to steal your source code. Do you want your source code to be visible to the whole world?
For local files, you should never use a full-blown URL. it is terribly inefficient and will not do what you want. why not just
include('/path/to/templates/100/index.php');
instead, which would be a local file-only request, without including an HTTP step?
source share