Output_fns. Your global web design fileHere is where you are going to make your website incredibly easy to manage. You will need to open both default.html and output_fns.php with your text editor. As we work, you will need to access both files so be prepared to minimize one file as you work on the other, then maximize the other when you need to get at it again. It may be a little confusing at first, but you will get the hang of it quickly. 1 - Open output_fns.php with your text editor. Step 2 - Open default.html with your text editor You should now have 2 files open on your desktop. If you don't maximize them, you can click on a part of the partially hidden one to bring it to the top. Scroll down this page to the code you will be copying and compare it with the code in your default.html file. You will notice that there is some new code in red. We have created a Function. A function is a snippet of code (or an entire program) that can be executed by simply "calling" it. Here, instead of duplicating the same html on every page, we simply execute it by calling it's function. A function MUST have PHP started <?php AND it MUST be enclosed in start { and stop } brackets. BEFORE switching to HTML, PHP must be stopped ?> All of the code, up to the end of your heading row is included in this function, except we made our comments more concise and we removed the borders on the table. (BORDER="0"). Copy all of the code below and paste it into the empty output_fns.php file. <?phpfunction display_html_header() { ?> <!-- Stop parsing PHP and start html. --> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252"> <TITLE></TITLE> <META NAME="description" CONTENT=""> <META NAME="keywords" CONTENT=""> </HEAD> <!-- SET THE MARGINS AND BACKROUND COLOR OF THE PAGE. --> <BODY BGCOLOR="#006600" LEFTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0" TOPMARGIN="0"> <!-- START OUR TABLE --> <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="5" BGCOLOR="white" WIDTH="750" ALIGN="center"> <!-- START ROW 1 --> <TR> <!-- START THE HEADING CELL --> <TD COLSPAN="2" BGCOLOR="#009966"><H1><FONT COLOR="#FFFF00">MYSITE.com</FONT></H1> <!-- END HEADING CELL --> </TD> <!-- END ROW 1 --> </TR> <!-- Start PHP again to end the function with the } --> <?php }
|