SKIP navigation
Buildit
Buildit

This page's main content:

buildit documentation

includes.

As you may have noticed, the pages you're viewing all have the '.php' extension. This lets the web server, in this case 'avalon', UNO's 'www.unomaha.edu' server, know that there are 'include' statements in the file to be processed. In this page's file, for example, there are several 'include' statements. Hey, here's one now:

<?php require("./../inc/06/mark.inc"); ?>

What this 'include' statement is directing the server to do, is look for the file that houses the 'UNO wordmark', and insert that into ('include' it) in the requested page before it is sent on to the user's web browser. Remember, it all happens on the server BEFORE being passed on to the user. That is why viewing this page's source code won't reveal the 'include' statements - they were processed and added to the page before you ever received it (also the reason that copying the source code won't actually give you the template). Aside from the '.php' extension, there is no evidence to the user of what was added or where - it's just as if the page existed as a single, complete file. Actually the UNO homepage has 14 separate 'includes'. This include ends with '.inc' but it could just as well end with '.htm'. The user-editable includes in your zipped template folder end with '.htm' — that file extension allows them to be more easily edited in Dreamweaver. If you're interested, the 'mark.inc' file contents looks like this:

<div id="head_mark"><a href="http://www.unomaha.edu" title="University of Nebraska at Omaha Home Page"><img src="http://www.unomaha.edu/img/lay/head_mark.gif" style="border: none;" alt="University of Nebraska at Omaha" /></a><h3>University of Nebraska at Omaha</h3></div><div id="head_mark_print"><img src="http://www.unomaha.edu/img/lay/head_mark_print.gif" alt="" /></div>

Now why, you might ask, would anyone want to use an' include'? Well, suppose that it was decided that the 'UNO Wordmark' needed to change, maybe it needs to be white text on a black background, or perhaps you just wanted to make sure that everywhere it appeared, it would look, and function exactly the same (which is the case here). In either case, by using a single file ('mark.inc') we can ensure that any changes to the file content will be reflected site-wide, just by changing the contents of that one file. That's what we'll call a one-to-many relationship, and it can save you a lot of work. Do you really want to change the footer on every single page when the year changes, or your phone number? By using 'includes' you can simplify things greatly.

Bear in mind though, that your 'included' files have to live on the same server (in this case avalon) as the files that point to them.