214-564-5316
Friday, March 12, 2010

Display pages in iframe depending on day of week

We don't use Front page Webbots in our sites because the extensions can go down without you knowing it and the code won't run.
You can insert content into a document depending on the day of the week by using ASP.
Create your seven content pages and name them 1.htm, 2.htm, 3.htm, etc.
Then create an ASP page and name it what ever you desire:

When you browse to the above ASP page the code will run ("parse") at the server.
This little bit here:

<% date_value = date() %>
<% dayofweek=weekday(date_value) %>


Creates a number based on the day of the week. Sunday=1, Monday=2, etc.
We then take that numerical value <%=dayofweek%> and stick it in the iframe code here:

<IFRAME src="<%= dayofweek %>.htm" width="500" height="300" scrolling="auto" frameborder="0"></IFRAME>

Where, on Sunday, it looks like this in the browser:

<IFRAME src="1.htm" width="500" height="300" scrolling="auto" frameborder="0"></IFRAME>

On Monday it would parse like this (and so on):

<IFRAME src="2.htm" width="500" height="300" scrolling="auto" frameborder="0"></IFRAME>

Here is the actual included content: