Wayne Berry
Editor, 15 Seconds
April 14, 1998
Download the classifieds site code
Contents
Introduction
Install IIS 4.0
XSession
XCheck
Configure SQL Server
Configure ODBC
Modify the Global Variables
Modify the Text
Modify the Logo
Summary
This article provides the installation instructions for building your own classifieds site with the downloadable code. The site is completely customizable, so you can create your own theme, regions, and categories. You will need to have access to Internet Information Server (IIS) and Microsoft SQL Server to run the classifieds site. You will also need to know HTML, graphics, SQL Server, IIS, and Active Server Pages (ASP) to customize the site.
This site is written with ASP and designed to run on IIS 4.0. To run the code, you will need to download and configure IIS 4.0.
IIS is part of the Windows® NT 4.0 Option Pack. You can download the Windows NT 4.0 Option Pack from this location:
http://www.microsoft.com/ntserver/web/default.asp
The Option Pack needs to be installed on top of Windows NT 4.0 Service Pack 3.0 and Windows NT Server. Once installed, you can begin configuring the Web site.
The code that you can download assumes that you have a separate domain for your classifieds site. All the files are located in a single directory that is the root of that domain. References to the files also assume that the files are located in the root of a domain. Get a single IP and configure Windows NT to service that IP. Using Microsoft data source name (DNS) Server, map the domain name to the IP. Now you can configure IIS to listen for requests and issue responses. Use the following instructions to configure your IIS machine:
You will not need IIS to maintain the built-in session state, because the Session object is not used. The session state is enabled by default, and for performance reasons you should turn it off if you are not using it. Here is how to turn the session state off:
All the files in the download should be placed in the directory that you created for the Web site. This is the same directory to which you mapped the IP.
XSession is used to keep the session state of the classifieds site and to maintain state across the user's visits. For example, when the user first visits the site a welcome message appears. However, on repeat visits this message doesn't appear. This information is kept in a file store that is accessed through XSession.
You can download XSession from this URL:
ftp://ftp.signmeup.com/xsession.zip
Once you have it downloaded, you'll need to install the component:
regsvr32 XSession.dll
There is a 30-day trial for this component. This will allow you to test the site without initially purchasing the component. To purchase the component, click the link below:
http://www.swregnet.com/1643p.htm
By default XSession will write the data store at:
c:\winnt\system32\inetsrv\XSession
If you wish to change this location, you can do so by changing the registry key at:
HKEY_LOCAL_MACHINE\SOFTWARE\SMUM\XSession\Parameters\Root
Depending on the traffic you are getting, the data store could get quite large, so take this into consideration with its placement. Also, if you are running two servers in a Web farm, you will want to point both servers to the same data store on one of the servers.
For more information about XSession go to:
http://www.signmeup.com/XSession.stm
XCheck is used verify the form input before allowing a post to go to the Web site. Using XCheck reduces the cost of maintaining the Web site, because each post does not need to be checked individually by the administrator -- ads can automatically go live on the site.
You can download XSession from this URL:
ftp://ftp.signmeup.com/xcheck.zip
To install the component:
regsvr32 XCheck.dll
There is a 30-day trial for this component. This will allow you to test the site without initially purchasing the component. To purchase the component, click the link below:
http://www.swregnet.com/875p.htm
For more information about XCheck go to:
http://www.signmeup.com/XCheck.stm
The classifieds site uses SQL Server extensively to generate the advertisements and the dynamic drop-down menus. For this reason, we recommend running SQL Server on a separate machine than the Web server.
The first thing you need to do is create a database to hold the tables that will be used for the site. For a medium-size site with 100-200 ads, you will need a 100-megabyte database device with a separate 50-megabyte log device.
Once you have the database created, you can run the SQL script that comes with the download. The name of the script is setup.sql. To run the script, follow the steps listed below:
The setup.sql script creates some default data that you can work with, however you will want to customize the site to your own needs. You can change the regions displayed, and the categories and the subcategories of ads.
You can modify the region table so that the right regions are included. For example, you might want to create an apartment classifieds for your city. The region table would then contain the different communities within your city.
Modifying the section table and the subsection table changes the categories that ads can go into. Depending on the site you are running, these tables will have different data. With the apartment example, you might want to make main sections with apartment styles -- studio, townhouse, shared living -- and subsections that are price ranges.
You will want to create a system DSN on the machine that is running the Web server. The DSN name should be "classified". This DSN is used by Active Server Pages to connect to the database, so point the DSN to the SQL Server with the default database being the one you created.
sql.asp contains the name of the DSN, the user name to use when logging into the SQL server, and the password for that user. This file is included in every ASP file that needs to make database calls. By default they are set like this:
Const SQLDSN = "classified" Const SQLUser = "usr_classified" Const SQLPassword = ""
If you change the DSN name, the user name, or the password, you will have to modify this file to match the changes. It is important to note that because this page is named with an asp extension it will always be executed if the script is turned on. In other words, there is no way for anyone to read this file and get your user name or password to the SQL server database.
There are several global variables that are used throughout the Web site. These are contained in the global.asp file, which (like sql.asp), is included in all the main pages. To modify these global variables, make changes to the global.asp. You must modify gstrCustServiceEmail, gstrServer, and gstrSiteName to make the site operate properly; the rest are used to customize the site.
To set the customer service e-mail addresses, modify the global variable called gstrCustServiceEmail. Note here the Hungarian notation that tells us this is a global string.
The JScript in the pages references the root of the server and needs the full URL to activate the pop-up windows. You will have to modify the global variable called gstrServer to be your domain name.
You will need to modify the site name. It is set in the global variable called gstrSiteName.
glMaxTextWordCount limits the amount of text that can be posted for each posting. Set glMaxTextWordCount to 200 to limit the postings to 200 words.
glMaxTitleWordCount represents the maximum number of words in the title of each posting.
Where there are no postings for the page, the message in gstrEmtpy is displayed to the user. By default it is set to "There are no advertisements for this section, keyword, or region."
When you mouse over one of the postings, the message in gstrClickOn is displayed. By default it reads "Click on the advertisement for more information."
glInsertSizeIncrement is used to allocate memory for the array that arranges the postings on the page. Setting glInsertSizeIncrement too low will cause the page to have to reallocate memory too often. Setting glInsertSizeIncrement too high will raise the memory requirements of the site. By default, glInsertSizeIncrement is set to 75. If you think that you will have more than 75 postings per page, you should raise this setting.
glNewDays is the number of days that a posting is considered new and receives the new logo next to the posting. Postings that are younger than glNewDays from the current date are displayed on the entrance page to the site. If this setting is too low and no postings are this new, the Web page will return to the SQL Server to get advertisements that are glNewDays older than glNewDays. This causes an additional round trip to the SQL Server. If glNewDays is too high, there will be too many ads on the entrance page, causing the page to load too slowly for the user. You need to set glNewDays based on the number of postings you are receiving on the site. The default is 2 days.
If there are only glNewAdMin postings to display that are new, the ASP will return to the SQL Server to find more postings. This setting prevents your entrance page from appearing empty when there are not many new postings. Setting glNewAdMin too low will create an empty look; setting it too high will cause extra work for SQL Server, degrading your performance. The default setting is 10 postings.
You can change the number of columns displayed on the site by changing glColumns. By default, glColumns is set to four columns. You can also change the width of those columns with the glColumnWidth setting. By default, the setting is 185 pixels. The default settings are set so that the site is viewable with a maximized Internet Explorer browser with a screen resolution of 800 x 600.
gstrBodyBGColor, gstrPColor, gstrSColor, gstrTColor, gstrButtonColor, gstrButtonDarkColor, gstrButtonLightColor, gstrButtonEdgeColor, gstrHighlightColor, gstrTextColor, gstrInverseTextColor and gstrVLinkColor control the color settings for the site. You can change these setting to match your brand or create them for your site. There are additional notes about the settings in the global.asp file.
When the user first comes to the site, a welcome message is displayed in a modal dialog box. The same text is used when the user chooses About from the More Info menu. This text is in a file called welcome_text.asp. You will have to modify this file to contain the greeting you wish the user to see. This page is not displayed directly, but is referenced from other ASP pages.
The copyright information is contained in a file called footer.asp. You will need to add your company information to the copyright text.
You will need to change the legal text that is displayed to the user when they click on the copyright at the bottom of the page, or when the user chooses Legal Notice from the More Info menu. This text is contained in popup_legal.txt.
The instructions that are presented to the user when they are posting to the site should be customized to reflect the theme and style of your site. You can change the text by changing the newpost_text.asp file.
You will need to create a logo for the header. You can do this by changing the logo.gif image. Make sure to change the height and width setting in the header.asp file to match the size of your new graphic.
Once you've completed all the steps above, you should be able to run your new classifieds site. If you create an Internet site with this code, drop us a line at webmaster@15Seconds.com so that we can take a look at your handiwork.
See also the downloadable classifieds site code and the article on the 15 Seconds Job Classifieds Technical Architecture. If you are interested in MSDN Online membership so you can access contact information on the site and post job openings, see the Community home page.
15 Seconds is a free Internet resource for developers working with Microsoft Internet Solutions and product lines of Sign Me Up Marketing SMUM, a leader in Internet marketing. Established in 1996, SMUM is a Seattle-based business owned by Wayne Berry, a well-known global programming consultant and co-author of Active X Programming Unleashed, Windows NT 4 Registry, and IIS 4.0 Special Edition.