Forum Moderators: phranque

Message Too Old, No Replies

Need more elegant XSSI solution

Xssi

         

Eva the librarian

12:09 am on Mar 29, 2003 (gmt 0)



Hello,

I have written an XSSI solution to displaying variable content on a web page, depending on what time it is and what day it is. It works, but it's a little ugly.

I'm wondering if there is a more elegant way to write it.

The issue is that, at differing times each day, a particular graphic is supposed to appear. This graphic leads people to a service that is only available during certain hours. When it's closed, we don't want anything to appear. We are open M-Th from 1-9, F-S from 2-6, and Sunday from 2-10.

As I said, I wrote something that works. But I was hoping to learn that my way is too "verbose." Is there a more elegant way to say the following?:

<!--#config timefmt="%A %H"-->
<!--#if expr="(\"$DATE_LOCAL\" = /Friday/ ¦¦ \"$DATE_LOCAL\" = /Saturday/) && (\"$DATE_LOCAL\" = /14/ ¦¦ \"$DATE_LOCAL\" = /15/ ¦¦ \"$DATE_LOCAL\" = /16/ ¦¦ \"$DATE_LOCAL\" = /17/ ¦¦ \"$DATE_LOCAL\" = /18/)" -->
<img src="images/button.gif" width="100" height="50" alt="Visit our live information service." border="0">

<!--#elif expr="(\"$DATE_LOCAL\" = /Sunday/) && (\"$DATE_LOCAL\" = /14/ ¦¦ \"$DATE_LOCAL\" = /15/ ¦¦ \"$DATE_LOCAL\" = /16/ ¦¦ \"$DATE_LOCAL\" = /17/ ¦¦ \"$DATE_LOCAL\" = /18/ ¦¦ \"$DATE_LOCAL\" = /19/ ¦¦ \"$DATE_LOCAL\" = /20/ ¦¦ \"$DATE_LOCAL\" = /21/ ¦¦ \"$DATE_LOCAL\" = /22/)" -->
<img src="images/button.gif" width="100" height="50" alt="Visit our live information service." border="0">

<!--#elif expr="(\"$DATE_LOCAL\" = /Monday/ ¦¦ \"$DATE_LOCAL\" = /Tuesday/ ¦¦ \"$DATE_LOCAL\" = /Wednesday/ ¦¦ \"$DATE_LOCAL\" = /Thursday/) && (\"$DATE_LOCAL\" = /13/ ¦¦ \"$DATE_LOCAL\" = /14/ ¦¦ \"$DATE_LOCAL\" = /15/ ¦¦ \"$DATE_LOCAL\" = /16/ ¦¦ \"$DATE_LOCAL\" = /17/ ¦¦ \"$DATE_LOCAL\" = /18/ ¦¦ \"$DATE_LOCAL\" = /19/ ¦¦ \"$DATE_LOCAL\" = /20/ ¦¦ \"$DATE_LOCAL\" = /21/)" -->
<img src="images/button.gif" width="100" height="50" alt="Visit our live information service." border="0">

<!--#else -->
<p>Sorry, we're closed right now. But you can email us your question.</p>
<!--#endif -->

Thanks to the kind stranger who checks my work for me...

Eva the librarian

heini

8:16 pm on Apr 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello Eva, welcome to WebmasterWorld!

I've moved your post to this forum as I hope some of our tech savvy members will come along to give you some qualified feedback.