x

Your Pages - Setup IIS Site

Sample ASP Page, Server-Side Fetch League Select, VBScript

Return - Your Pages Setup

In this sample, you only need the programming in blue.

For a quick-start, you can copy and paste this code to a file in your website named "SampleIframeLeagueSelect.asp", then view this page in your browser: http://(YourSite)/SampleServerFetchLeagueSelect.asp

Working sample: http://www.divebarsussex.com/SampleServerFetchLeagueSelect.asp
(displaying the sample code below)

If you would rather skip the sample page, just copy and paste the blue lines into your .asp page.

<%  ' Sample League Select file, using server-side fetch, for IIS Server, ASP VBScript
    ' -------------  These top 3 settings will propogate to the other pages
    xES = 3        ' Master define EstablishmentNo
    xSP = 1        ' Master define this SportNo
    xDM = 0        ' Master define the DisplayMode (0=InlineServerFetch,1=iframe)
    URLStr = "http://www.easyleagues.biz/Content/SelectLeague.asp?" & _
        "rES=" & xES & "&rSP=" & xSP & "&rDM=" & xDM %>
<!--#INCLUDE FILE="./SampleServerFetchFuncs.inc"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
  <title>Server-Side Fetch Sample - League Select</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link href="./EasyLeagues.css" rel="stylesheet" type="text/css" />
  <style type="text/css"><!--
  .easyLeaguesDiv  {width: 90%; height: 200px; margin: 5px 5%;
                    padding: 10px; border: 1px solid #c0c0c0;} --></style>
</head>
<body>
  <div style="width: 800px; height: 100px; border: 1px solid #000000;">
    Your page header/banner here.
  </div>
  <div style="width: 800px; border: 1px solid #000000;">
    <p>Your personalized page-body content here, before the League Select content.</p>
    <!-- The first part of your page programming before here -->
    <!-- Begin needed programming -->
    <div class="easyLeaguesDiv"><%= GetEasyLeaguePage(URLStr) %></div>
    <!-- End needed programming -->
    <!-- The remainder of your page programming after here -->
  </div>
  <div style="width: 800px; height: 100px; border: 1px solid #000000;">
    Your page footer here.
  </div>
</body>
</html>

Note in the example above the required line that contains "INCLUDE FILE A nice feature in ASP is the ability to "merge" (or "include") another file.

VBScript INCLUDE Common Code File.

You will need some scripting to fetch from the EasyLeagues.biz site the HTML to include in the output of your web page. Since this scripting will be the same for all content fetched by your site server, it will be easiest to put this code in a single file, then INCLUDE this scripting in all of your files that fetch EasyLeagues.biz content.

For a quick-start, you can copy and paste this code to a file in your website named "SampleServerFetchFuncs.inc" (if you choose a different filename, be sure to change the filename in the above INCLUDE FILE line to match).

<%
'------------------------------------------------------------------------------
' Purpose: fetch HTML code from the EasyLeagues.biz site
'------------------------------------------------------------------------------
Function GetEasyLeaguePage(sPageName)
  Set ELConn = CreateObject("Microsoft.XMLHTTP")
  ' append a Random Number to the QueryString, to prevent caching at the server
  sPageName = sPageName & "&rXX=" & RandNum(1, 10000)
  ELConn.Open "GET", sPageName, False
  On Error Resume Next
  ELConn.Send
  GetCode = ELConn.ResponseText
  If GetCode = "" Then
    GetEasyLeaguePage = "The page is not available"
  Else
    GetEasyLeaguePage = GetCode
  End if
  On Error GoTo 0
  Set ELConn = Nothing
End Function
'------------------------------------------------------------------------------
Function RandNum(iMin, iMax)
  Randomize                                           ' needed to initiate random generator
  RandNum = Int((iMax- iMin + 1) * Rnd + iMin)
End Function
%>
How it works, required programming.

Your server will fetch content from the EasyLeagues.biz site using a script to call a simple URL (address) based on "http://www.easyleagues.biz/Content/SelectLeague.asp". To retrieve the specific information for your site from the EasyLeagues.biz database, you will also need the information after the "?" (question mark) which are known as "Query String Parameters".

Query String Parameters.

The EasyLeagues.biz site needs to know what "EstablishmentNumber" to lookup in the database, so you will need "rES=3" (change number 3 to your EstablishmentNumber). You may be using EasyLeagues.biz for multiple sports at your site, so set the "SportNumber" with "rSP=1" (for SportNumber 1, which will be your first sport setup in EasyLeagues.biz). Set the "DisplayMode" with "rDM=0", this will generate page-body only output.

Remember to seperate each parameter with an "&" (ampersand).

You will note in the example that the method of setting the "EstablishmentNumber" and "SportNumber" values to a variable was used. Then the variable URLStr was constructed using these variables. If you wanted to skip the variable setup at the top of the page, you could hard-code the URLStr attribute of the GetEasyLeaguePage(URLStr) function call to the required URL.

Because the EasyLeagues.biz information is now injected directly into your web page code sent to the visitor, you can treat the HTML as an integral part of your page.

Standards Note: The code fetched from EasyLeagues.biz is XHTML 1.0 TRANSITIONAL compliant. If you require a different standard, let us know and we may be able to accomodate you.

Sample Page Styles and Links

The styles and links in the sample pages will not work properly until you have copied the sample CSS files to your site and configured "Settings" in EasyLeagues.biz, but the content will display without problem.