About the PHP Engine

Pages for the offices are produced dynamically every time they are accessed. This section provides a relatively non-technical explanation for how it works.

The underlying files for these pages are written in PHP, a scripting language that is widely used to create dynamic web pages, that is, pages that change depending on various conditions. The PHP code evaluates those conditions and generates a page in HTML that can be read by your web browser.

For these Daily Prayer pages, the main problem is knowing what day it is, at least liturgically. Fortunately, PHP can get the calendar day (including month, day of the month, day of the week, year, day of the year, whether it is a leap year, and even the week of the year) from the server, and it “knows” what day Easter is each year, so with some careful thinking, it is possible to write a program that calculates the “liturgical day” according to the calendar in the ELW.

This finished PHP code sits on the server. When your browser requests an ordinary HTML page, the server just sends the file to your computer. However, with a PHP page, the process is different. When you request a page written in PHP, the server executes the PHP code and produces a new HTML page which is sent to your computer. Your computer never gets the original PHP code.

When a request comes in for one of these Daily Prayer pages, the PHP code first determines the “liturgical day.” For example, if you want to say Morning Prayer on a day that is after Epiphany I (which can be calculated by looking at what day of the week Epiphany falls on) but before Ash Wednesday (which is 46 days before Easter), it can subtract the day of the year corresponding to Epiphany I from “today,” divide by 7, and figure out that this is the week of Epiphany X. Then it looks at the day of the week to see if it is one of the days before Epiphany X, the Xth Sunday after Epiphany, or one of the days after Epiphany X.

Once the program knows what day it is, it’s a simple matter to assemble all the different pieces of the service, add in the lessons listed in the lectionary, and produce the HTML page for the service that was requested. That server then sends the HTML page to your computer.

These PHP pages were written in August 2009 by Bill Potter, LCH webmaster. Your comments and suggestions are welcome at webmaster@lchwelcome.org

Links

Return to the Daily Prayer home page.

To say one of the offices, follow one of these links:

Morning Prayer Evening Prayer
Noon Prayer Compline

Daily Prayer is brought to you by the people of the Lutheran Church of Honolulu.


Valid HTML 4.01 TransitionalCopyright © 2009 Lutheran Church of Honolulu
1730 Punahou Street, Honolulu, HI 96822 • 808-941-2566
Comments welcome at webmaster@lchwelcome.org