Penn State

Web Conference 2005

Writing PHP for ITS/ASET Web services

Viewing the PHP Source

  Up   

Showing PHP Source Code

This site makes use of the highlight_string() and highlight_file() functions, which color codes PHP source code for visibility.

How to Show PHP Source On This Site

As described in the Basic Web Form lesson, you simply need to click the link at the bottom of each page to, "See the source for this page."

About Showing PHP Source On This Site

You may notice the "See the source for this page" link will link back to the same file with "?showsource" set. This will be caught automatically for each file to trigger a function that will display the highlighted source code, followed by the rendered content. Precisely how this is done is left as an exercise to the reader. Follow the lessons in this tutorial for concepts and techniques that may help you figure it out.

Including Other PHP Scripts for Common Functionality

You may notice include "header.php";, include "navbar.php"; and include "footer.php"; in the displayed code of each page. While not described in the crash course on PHP lesson, these include() lines incorporate other PHP scripts for common uses, such as headers, navigation bars and footers as these are respectively used.

You may see the source code for these included files:

You may also see the source code for the subsequent files they use:

  Up   

If you have any questions, feel free to ask me.

Content by: Jeff D'Angelo <jcd@psu.edu> © 2005

See the source for this page

Last update on: Sun Jun 12, 2005, 9:54:43 PM