« Absolute positioning for Search Engines | Main | Build Your Website with a Plan »

October 29, 2004

Use XSSI to Publish A Weekly Schedule

Let's assume you have sold access to a weekly course. People are logging on to your site for new instructions and lessons every day. Due to your schedule, you are finding it hard to keep the lessons updated and manage your other responsibilities. You want to have the the lessons for each day appear on the same page so you don't have to keep giving your students a different URL each day.

Or let's assume you have to publish a weekly schedule.

Or maybe... You want your site visitors to see a fresh list of articles every day when they visit your site.

In each of these cases the content could be prepared in advance, on a day when you have time, and then use XSSI to make sure the correct page loads on the correct day; regardless of whether it is a list of articles or lessons.

XSSI means Extended Server Side Includes.

The first thing you need to do is tell the server what day it is so it will know what page to load:

<!--#config timefmt="%A" -->
<!--#set var="weekday" value="${DATE_LOCAL}" -->

This gets the day, and stores it into a variable called "weekday."

<!--#if expr="'${weekday}' = 'Sunday'" -->
<!--#include file="sunday.inc" -->

So... if it is Sunday, this tells the server to load the "sunday.inc" (included file fragment) into your lesson plan page. What if it isn't Sunday? What if it is Monday?

<!--#elif expr="'${weekday}' = 'Monday'" -->
<!--#include file="monday.inc" -->

Notice the change from "#if" to "#elif" -- this means if the condition isn't met, and it isn't Sunday... then if it is Monday... load "monday.inc"

Let's continue:

<!--#elif expr="'${weekday}' = 'Tuesday'" -->
<!--#include file="tueday.inc" -->

<!--#elif expr="'${weekday}' = 'Wednesday'" -->
<!--#include file="wednesday.inc" -->

<!--#elif expr="'${weekday}' = 'Thursday'" -->
<!--#include file="thursday.inc" -->

<!--#elif expr="'${weekday}' = 'Friday'" -->
<!--#include file="friday.inc" -->

<!--#elif expr="'${weekday}' = 'Saturday'" -->
<!--#include file="saturday.inc" -->

There are only seven days in the week so we need to tell the server that we have reached the end of the conditional statements so the last line of code is:

<!--#endif -->

Now you can do your lessons plans when you have time, upload them and let the server deliver the content on the day your site needs to be updated.

Posted by Steve MacLellan at October 29, 2004 03:20 PM

Trackback Pings

TrackBack URL for this entry:
http://www.homebusiness-websites.com/mt/mt-tb.cgi/5

Comments

Post a comment

Thanks for signing in, . Now you can comment. (sign out)

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


Remember me?