W
wingnut144
Currently I have a XML file in the following format:
<?xml version="1.0" encoding="utf-8"?>
<class>
<sdate>9/10/07</sdate>
<special>1,2</special>
<inst>Max Callao</inst>
<sdate>10/22/07</sdate>
<special>1,2</special>
<inst>Max Callao</inst>
<sdate>11/26/07</sdate>
<special>3</special>
<inst>Steve Grosz</inst>
<sdate>1/28/08</sdate>
<special>1,2</special>
<inst>Andy Gearhart</inst>
<sdate>3/10/08</sdate>
<special>3</special>
<inst>Max Callao</inst>
<sdate>4/21/08</sdate>
<special>1,2</special>
<inst>Max Callao</inst>
</class>
And that data is used in:
<!--- Reads in SB1 xml file with dates and instructor info --->
<cffile action="read" file="C:\Inetpub\wwwroot\SalleBoise\sb1.xml"
variable="xmldoc">
<cfset mydoc = XmlParse(xmldoc)>
<cfset mydoc_stuff = XmlSearch(mydoc, "/class/sdate")>
<cfset cl_inst= XmlSearch(mydoc, "/class/inst")>
<cfset cl_spec=xmlSearch(mydoc, "/class/special")>
<cfset CurrDate=dateformat(now(),"mmmm d,yyyy")>
<!--- Starts off the inital item count --->
<cfset icount=1>
<div align="left" style="margin:0 auto;">
<cfloop index="mydoc_item" from="1" to=#ArrayLen(mydoc_stuff)#>
<cfset mydoc_data = mydoc_stuff[mydoc_item].XmlText>
<cfset mydoc_inst= cl_inst[mydoc_item].XmlText>
<cfset mydoc_spec=cl_spec[mydoc_item].XmlText>
<!--- Find the number of days between the start of the session and
the
current date --->
<cfset temp=datediff("d",mydoc_data,CurrDate)>
<!--- Send end date for classes, calculated by adding 23 days to start
of
beginning of class --->
<cfset temp2=dateformat(dateadd("d",23,mydoc_data),"m/d/yy")>
<!--- Check to see if date of classes are more than 3 months out, or
are
more than 14 days in the past (based on class ending date), if so,
don't
display --->
<cfif (datediff("m",CurrDate,mydoc_data) gte 3) or
(datediff("d",temp2,CurrDate) gte 15)>
<cfelse>
<!--- If class date is more than 23 days old, mark as 'not available'
--->
<cfif temp gt 23>
<img src="images/small_no_class.gif" style="padding-right:5px;
margin-left:25px;" alt="Class Finished" title="Class Finished"
/><cfoutput>Session #icount#: <span
class="fake_strikethrough">#mydoc_data# -- #temp2#</span><br />
<div align="left" style="font:Arial, Helvetica, sans-serif; font-size:
10px;
float:left; padding-left:62px;">Instructor: #mydoc_inst#</div><br
clear="left">
<div style="padding-left:62px; float:left; font-size:10px;">Class
type:
<cfloop list="#mydoc_spec#" delimiters="," index="i">
<cfswitch expression="#i#">
<cfcase value="1">
Beginner,
</cfcase>
<cfcase value="2">
Intermediate
</cfcase>
<cfcase value="3">
Workshop session
</cfcase>
</cfswitch>
</cfloop>
</div><br clear="left">
<!--- <cfif len(mydoc_spec) gte 1><div style="padding-left:10px;
float:left;
font-size:9px;"><strong>Workshop session</strong></div><br
clear="left"></cfif> --->
</cfoutput>
<!--- If class start date is today AND and the class ending date is
less
than 23 days, mark as 'in session' --->
<cfelseif (datediff("d",mydoc_data,CurrDate) gte 0) and
(datediff("d",mydoc_data,CurrDate) lte 23)>
<img src="images/small_in_session_class.gif" style="padding-right:
5px;
margin-left:25px;" alt="In session" title="In session" /
<div align="left" style="font:Arial, Helvetica, sans-serif; font-size:
10px;
float:left; padding-left:62px;">Instructor: #mydoc_inst#</div><br
clear="left">
<div style="padding-left:62px; float:left; font-size:10px;">Class
type:
<cfloop list="#mydoc_spec#" delimiters="," index="i">
<cfswitch expression="#i#">
<cfcase value="1">
Beginner,
</cfcase>
<cfcase value="2">
Intermediate
</cfcase>
<cfcase value="3">
Workshop session
</cfcase>
</cfswitch>
</cfloop>
</div><br clear="left">
</cfoutput>
<cfelse>
<!--- Otherwise mark the class as available to sign up for --->
<!--- Display register icon if class is 45 days or less before start
of
class --->
<cfif datediff("d",CurrDate, mydoc_data) lte 45>
<div class="reg_img" style="float:right; width:65px;"><a
href="https://www.memberst.com/Programs/Sessions.aspx?
id=18355939-76D7-4927-B9E4-1C4EF29CDF0B"
target="_blank"><cfoutput>
<img src="images/small_online_register.gif" alt="Register for
#mydoc_data#
class" name="register" width="15" height="15" border="0"
style="padding-left:5px;" title="Register for #mydoc_data#
class"/></cfoutput></a></div>
</cfif>
<img src="images/small_yes_class.gif" style="padding-right:5px;
margin-left:25px;" alt="Upcoming" title="Upcoming" /
<div align="left" style="font:Arial, Helvetica, sans-serif; font-size:
10px;
float:left; padding-left:62px;">Instructor: #mydoc_inst#</div><br
clear="left">
<div style="padding-left:62px; float:left; font-size:10px;">Class
type:
<cfloop list="#mydoc_spec#" delimiters="," index="i">
<cfswitch expression="#i#">
<cfcase value="1">
Beginner,
</cfcase>
<cfcase value="2">
Intermediate
</cfcase>
<cfcase value="3">
Workshop session
</cfcase>
</cfswitch>
</cfloop>
</div><br clear="all">
</cfoutput>
</cfif>
</cfif>
<cfset icount=icount+1>
</cfloop>
I'd like to see about adding a <location> tag to the XML so we could
have
something like:
<location>
<location1>
<class>
<sdate>9/10/07</sdate>
<special>1,2</special>
<inst>Max Callao</inst>
<sdate>10/22/07</sdate>
<special>1,2</special>
<inst>Max Callao</inst>
<sdate>11/26/07</sdate>
<special>3</special>
<inst>Steve Grosz</inst>
<sdate>1/28/08</sdate>
<special>1,2</special>
<inst>Andy Gearhart</inst>
<sdate>3/10/08</sdate>
<special>3</special>
<inst>Max Callao</inst>
<sdate>4/21/08</sdate>
<special>1,2</special>
<inst>Max Callao</inst>
</class>
</location1>
<location2>
And similar info as above
</location2>
But my question (after all of this) is how to change the .cfm page to
loop
over each location and then display the information.
You can see the result of the page as it stands now at
www.salleboise.com/class_schedule.cfm
Thanks!!
<?xml version="1.0" encoding="utf-8"?>
<class>
<sdate>9/10/07</sdate>
<special>1,2</special>
<inst>Max Callao</inst>
<sdate>10/22/07</sdate>
<special>1,2</special>
<inst>Max Callao</inst>
<sdate>11/26/07</sdate>
<special>3</special>
<inst>Steve Grosz</inst>
<sdate>1/28/08</sdate>
<special>1,2</special>
<inst>Andy Gearhart</inst>
<sdate>3/10/08</sdate>
<special>3</special>
<inst>Max Callao</inst>
<sdate>4/21/08</sdate>
<special>1,2</special>
<inst>Max Callao</inst>
</class>
And that data is used in:
<!--- Reads in SB1 xml file with dates and instructor info --->
<cffile action="read" file="C:\Inetpub\wwwroot\SalleBoise\sb1.xml"
variable="xmldoc">
<cfset mydoc = XmlParse(xmldoc)>
<cfset mydoc_stuff = XmlSearch(mydoc, "/class/sdate")>
<cfset cl_inst= XmlSearch(mydoc, "/class/inst")>
<cfset cl_spec=xmlSearch(mydoc, "/class/special")>
<cfset CurrDate=dateformat(now(),"mmmm d,yyyy")>
<!--- Starts off the inital item count --->
<cfset icount=1>
<div align="left" style="margin:0 auto;">
<cfloop index="mydoc_item" from="1" to=#ArrayLen(mydoc_stuff)#>
<cfset mydoc_data = mydoc_stuff[mydoc_item].XmlText>
<cfset mydoc_inst= cl_inst[mydoc_item].XmlText>
<cfset mydoc_spec=cl_spec[mydoc_item].XmlText>
<!--- Find the number of days between the start of the session and
the
current date --->
<cfset temp=datediff("d",mydoc_data,CurrDate)>
<!--- Send end date for classes, calculated by adding 23 days to start
of
beginning of class --->
<cfset temp2=dateformat(dateadd("d",23,mydoc_data),"m/d/yy")>
<!--- Check to see if date of classes are more than 3 months out, or
are
more than 14 days in the past (based on class ending date), if so,
don't
display --->
<cfif (datediff("m",CurrDate,mydoc_data) gte 3) or
(datediff("d",temp2,CurrDate) gte 15)>
<cfelse>
<!--- If class date is more than 23 days old, mark as 'not available'
--->
<cfif temp gt 23>
<img src="images/small_no_class.gif" style="padding-right:5px;
margin-left:25px;" alt="Class Finished" title="Class Finished"
/><cfoutput>Session #icount#: <span
class="fake_strikethrough">#mydoc_data# -- #temp2#</span><br />
<div align="left" style="font:Arial, Helvetica, sans-serif; font-size:
10px;
float:left; padding-left:62px;">Instructor: #mydoc_inst#</div><br
clear="left">
<div style="padding-left:62px; float:left; font-size:10px;">Class
type:
<cfloop list="#mydoc_spec#" delimiters="," index="i">
<cfswitch expression="#i#">
<cfcase value="1">
Beginner,
</cfcase>
<cfcase value="2">
Intermediate
</cfcase>
<cfcase value="3">
Workshop session
</cfcase>
</cfswitch>
</cfloop>
</div><br clear="left">
<!--- <cfif len(mydoc_spec) gte 1><div style="padding-left:10px;
float:left;
font-size:9px;"><strong>Workshop session</strong></div><br
clear="left"></cfif> --->
</cfoutput>
<!--- If class start date is today AND and the class ending date is
less
than 23 days, mark as 'in session' --->
<cfelseif (datediff("d",mydoc_data,CurrDate) gte 0) and
(datediff("d",mydoc_data,CurrDate) lte 23)>
<img src="images/small_in_session_class.gif" style="padding-right:
5px;
margin-left:25px;" alt="In session" title="In session" /
#icount#: #mydoc_data# -- #temp2#<br /><cfoutput>Session
<div align="left" style="font:Arial, Helvetica, sans-serif; font-size:
10px;
float:left; padding-left:62px;">Instructor: #mydoc_inst#</div><br
clear="left">
<div style="padding-left:62px; float:left; font-size:10px;">Class
type:
<cfloop list="#mydoc_spec#" delimiters="," index="i">
<cfswitch expression="#i#">
<cfcase value="1">
Beginner,
</cfcase>
<cfcase value="2">
Intermediate
</cfcase>
<cfcase value="3">
Workshop session
</cfcase>
</cfswitch>
</cfloop>
</div><br clear="left">
</cfoutput>
<cfelse>
<!--- Otherwise mark the class as available to sign up for --->
<!--- Display register icon if class is 45 days or less before start
of
class --->
<cfif datediff("d",CurrDate, mydoc_data) lte 45>
<div class="reg_img" style="float:right; width:65px;"><a
href="https://www.memberst.com/Programs/Sessions.aspx?
id=18355939-76D7-4927-B9E4-1C4EF29CDF0B"
target="_blank"><cfoutput>
<img src="images/small_online_register.gif" alt="Register for
#mydoc_data#
class" name="register" width="15" height="15" border="0"
style="padding-left:5px;" title="Register for #mydoc_data#
class"/></cfoutput></a></div>
</cfif>
<img src="images/small_yes_class.gif" style="padding-right:5px;
margin-left:25px;" alt="Upcoming" title="Upcoming" /
#icount#: #mydoc_data# -- #temp2#<br /><cfoutput>Session
<div align="left" style="font:Arial, Helvetica, sans-serif; font-size:
10px;
float:left; padding-left:62px;">Instructor: #mydoc_inst#</div><br
clear="left">
<div style="padding-left:62px; float:left; font-size:10px;">Class
type:
<cfloop list="#mydoc_spec#" delimiters="," index="i">
<cfswitch expression="#i#">
<cfcase value="1">
Beginner,
</cfcase>
<cfcase value="2">
Intermediate
</cfcase>
<cfcase value="3">
Workshop session
</cfcase>
</cfswitch>
</cfloop>
</div><br clear="all">
</cfoutput>
</cfif>
</cfif>
<cfset icount=icount+1>
</cfloop>
I'd like to see about adding a <location> tag to the XML so we could
have
something like:
<location>
<location1>
<class>
<sdate>9/10/07</sdate>
<special>1,2</special>
<inst>Max Callao</inst>
<sdate>10/22/07</sdate>
<special>1,2</special>
<inst>Max Callao</inst>
<sdate>11/26/07</sdate>
<special>3</special>
<inst>Steve Grosz</inst>
<sdate>1/28/08</sdate>
<special>1,2</special>
<inst>Andy Gearhart</inst>
<sdate>3/10/08</sdate>
<special>3</special>
<inst>Max Callao</inst>
<sdate>4/21/08</sdate>
<special>1,2</special>
<inst>Max Callao</inst>
</class>
</location1>
<location2>
And similar info as above
</location2>
But my question (after all of this) is how to change the .cfm page to
loop
over each location and then display the information.
You can see the result of the page as it stands now at
www.salleboise.com/class_schedule.cfm
Thanks!!