How to Use the Include File Syntax in ASP, HTML, and PHP


Understanding the include file syntax is a good way of simplifying your job as a coder. The include syntax allows you to call a file and execute it along with the rest of the code in it. This saves you a lot of time in inserting long codes or texts in your script. Editing is easier too if you use the include file syntax.

Include file can be used in ASP, PHP, and HTML. Here are formats and examples on how to use them:

HTML

<!–#include FILE=”file.inc” –>

ASP

<!–#include file=”file.inc”–>

PHP

<?php include(“file.php”); ?>

Just change the file name in between the quotation marks and you’re good to go. Make sure that the file included is a tested and working code. Save it where index.php is located. Otherwise, you have to specify the path to the file’s location.

Such as:

<!– #include file=”/html/file.inc” –>

AndysWebTools...Easy as Pie! AndysWebTools...Easy as Pie!