XML Vol 2 Issue 2 - pg.18
Slide Show On The Web Using SMIL, by Siet-Leng Lai


Listing 1
<smil>
<head>
   <layout>
     <root-layout width="400" height="480" background-color="black" />
      <region id="photo" left="50" top="50" width="350" height="250" />
      <region id="caption" left="50" top="250" width="300" height="180" />
    </layout>
</head>
<body>
<seq>
   <par dur="4s">
      <img src="http://lsla.ccs.np.edu.sg/travel/japancover.jpg" region="photo" />
      <text src="http://lsla.ccs.np.edu.sg/travel/1cover.html" region="caption" />
   </par>
   <par endsync="first">
      <audio src="http://lsla.ccs.np.edu.sg/travel/Sakura.mid" dur="indefinite"/>
      <seq>
         <par>
            <img src="http://lsla.ccs.np.edu.sg/travel/japan1.gif" region="photo" />
            <audio src="http://lsla.ccs.np.edu.sg/travel/narration1.wav"  />
         </par>
         <par>
             <img src="http://lsla.ccs.np.edu.sg/travel/japan2.gif" region="photo" />
             <audio src="http://lsla.ccs.np.edu.sg/travel/narration2.wav" />
         </par>
         <par>
             <img src="http://lsla.ccs.np.edu.sg/travel/japan3.gif" region="photo" />
             <audio src="http://lsla.ccs.np.edu.sg/travel/narration3.wav" />
         </par>
         <par>
             <img src="http://lsla.ccs.np.edu.sg/travel/japan4.gif" region="photo" />
             <audio src="http://lsla.ccs.np.edu.sg/travel/narration4.wav" />
         </par>
      </seq>
   </par>
</seq>

</body>
</smil>


<%

 

Listing 2

' create a HTML document for the cover slide
' and output text and audio object for the cover slide of the tour
' collection

sub outputcover(urlref, no, name, desc, music, imagefile)

  dim objFSO, objNew

  set objFSO = CreateObject("Scripting.FileSystemObject")
  pathname = Server.MapPath("/travel/"&no&"cover.html")
  set objNew = objFSO.CreateTextFile(pathname)

  objNew.writeLine("<html>")
  objNew.writeLine("<head>")
  objNew.writeLine("<title>Travel Collection</title>")
  objNew.writeLine("</head>")
  objNew.writeLine("<body bgcolor=black>")
  objNew.writeLine("<p>")
  objNew.writeLine("<font color=""yellow"">")
  objNew.writeLine("<h2>Virtual Tour Slide Show</h2>")
  objNew.writeLine("<p>")
  objNew.writeLine("</font>")

  objNew.writeLine("<font color=""cyan"">")
  objNew.writeLine("<h3>Tour Collection : "&name&"</h3>")
  objNew.writeLine("</font>")


  objNew.writeLine("<font color=""white"">")
  objNew.writeLine("<h4>"&desc&"</h4>")
  objNew.writeLine("</font>")


  objNew.writeLine("</body></html>")
  objNew.close

  response.write("<par dur=""4s"">")

  response.write("<img src="""&urlref&imagefile&""" region=""photo"" />")

  response.write("<text src="""&urlref&no&"cover.html"" region=""caption"" />")
  response.write("</par>")

  response.write("<par endsync=""first"">")

  if music <> "" then
    response.write("<audio src="""&urlref&music&""" dur=""indefinite""/>")
  end if


end sub







Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open "dsn=travel"

flag=request("flag")


if flag = "" then     %>
<html>
<head>
<title> Virtual Tour Slide Show </title>
<link rel="stylesheet" type="text/css" href="standard.css">
</head>
<body>
<h1 align=center>Virtual Tour Slide Show</h1>
<form action="slideshow.asp" method=POST>
<input name="flag" type="hidden" value="next">
<b>Tour Collection Name </b> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
<select name="collectionname" size="1">


<%sql_collection = "select * from collection "

Set rs_collection = Conn.Execute(sql_collection)

Do while Not rs_collection.EOF
%>

  <option> <%= rs_collection("name")%> </option>

<%
  rs_collection.Movenext
Loop
%>
</select>
&nbsp&nbsp&nbsp<input type="submit" value="Show Now!">
</form >
</body>
</html>

<%else
  response.ContentType="application/smil"
%>

<!--#Include File="header.inc" -->
<%
iname = request("collectionname")

collection_name = Trim(iname)

sql_collection = "select * from collection where name = '"& collection_name &"'"
sql_photo = "select * from photo where collection_id ='"
Set rs_collection = Conn.Execute(sql_collection)

if rs_collection.EOF then
  response.write("statement="&sql_collection)
  response.write("<text src=""error0.html"" region=""photo"" />")
else
  collection_no = rs_collection("id")

  set rs_photo = Conn.Execute(sql_photo & collection_no & "'")

  if rs_photo.EOF then
     response.write("<text src=""error1.html"" region=""photo"">")
  else
     seqno = 1
     name = rs_collection("name")
     music = rs_collection("background_music")
     imagefile = rs_collection("cover_image")
     desc = rs_collection("description")
     urlref = "http://lsla.ccs.np.edu.sg/travel/"

     call outputcover(urlref, collection_no, name, desc, music, imagefile)

     response.write("<seq>")


     Do while Not rs_photo.EOF
        response.write("<par>")
        response.write("<img src="""&urlref&rs_photo("image_source")&""" region=""photo"" />")
        if rs_photo("narration") <> "" then
           response.write("<audio src="""&urlref&rs_photo("narration")&""" />")
        end if
        response.write("</par>")

        seqno = seqno + 1

    rs_photo.Movenext
  Loop

  response.write("</seq>")
  response.write("</par>")
  response.write("</seq>")
  end if
end if

end if
%>

</body>
</smil>