Skip to page content or skip to Accesskey List.
Search evolt.org
evolt.org login: or register

Work

Main Page Content

Dynamic Websites ... on a CD.

Rated 3.45 (Ratings: 7) (Add your rating)

Log in to add a comment
(7 comments so far)

Want more?

 
Picture of rob.smith

Rob Smith

Member info | Full bio

User since: November 06, 2002

Last login: September 17, 2007

Articles written: 1

Many people have asked how to do this over the years. Most solutions involved a static presentation, which any novice can produce. I will attempt to illustrate what it takes to bring your favorite dynamic website to your system, without the big WWW... at all.

Stuff You Need

  • A CD writable drive to make the CD
  • CD writing software
  • Microsoft Access Database (97 preferrably. I'll explain why later)
  • Notepad or any another web page authoring tool
  • Knowledge of VBScript/ASP will do you good here

Let's Get Started

Assuming you, your computer, and any and all applications are ready to work...
  1. Start off by creating a Microsoft Access 97/2000 database.
    You can use a MS Access 2000 database but if you want greater compatibility to older systems such as Windows NT 4.0, 97 is the way to go. Just make sure you convert your database to 97 when you've finished modifying the 2000 version.
  2. Next, you'll want to create your Dynamic HTML page.
    That's right. I said dynamic html page; no need to blink and/or rub your eyes. The following script will illustrate how to do so.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>My First Dynamic HTML Page</title>
  3. Add CD-Rom detection script.
    You'll need this to determine the exact path to the actual database (which will be located on the CD-Rom). This information is vital for step 4. The code below will pick out the correct CD-Rom drive regardless if you place your CD in the 15th bay of a 31 bay CD-Rom drive tower. The code will break if there is an identical database name as yours in another CD-Rom drive. To avoid this, just name your database something completely unique.

    <script language="VBScript">
        
            'Declare variables used in this code
          Dim CD_Rom, FilePath, DriveLetter, DriveType, FileSystemObject, Drives
    
            'Create a filesystem object
    
            Set FileSystemObject = CreateObject("Scripting.FileSystemObject") 
        Set Drives = FileSystemObject.Drives 'Create a drives collection 
    
            For Each DiskDrive in Drives
               DriveLetter = DiskDrive.DriveLetter
       DriveType = DiskDrive.DriveType
    
                if DiskDrive.DriveType = "4" then
          CD_Rom = DiskDrive.DriveLetter
          FilePath = CD_Rom & ":\YourDataBase.mdb"
            
          Set FileSys = CreateObject("Scripting.FileSystemObject")
            
          If FileSys.FileExists(FilePath) then 
             'This is the correct
      CD-Rom drive.
             Exit For
          else
             'Keep trying
          end if
            
       end if
            
          Next
    
            'Clean up data usage
            Set Drives = nothing
            Set FileSystemObject = nothing
          Set FileSys = nothing
    
  4. Add the DSN script
    If you want to connect to any database, you'll need a "vehicle" to do so. A DSN (Data Source Name) is just want the doctor ordered.
        'Declare variables used in this code
        Dim Recordset1
        
        Recordset1 = CreateObject("ADODB.Recordset")
        Recordset1.ActiveConnection = "Driver={Microsoft Access Driver (*.mdb)};Dbq=" & FilePath & ";Uid=admin;Pwd="
        Recordset1.Source = "SELECT * FROM YourTable WHERE Conditions=Exist"
        Recordset1.CursorType = 0
        Recordset1.CursorLocation = 2
        Recordset1.LockType = 3
        Recordset1.Open() 
      
  5. Finish off the script
        </script>
    </head>
    <body>
         
  6. Write your dynamic code
    Use this script as often as you need throughout your newly created dynamic HTML page.
    <script language="VBScript">
       if not Recordset1.Fields.Item("ColumnName").Value
    = "" then
          document.write(Recordset1.Fields.Item("ColumnName").Value)
       end if
    </script>
         
  7. Finish your HTML page
    You'll also want to close your database connection as good housekeeping practice.
    </body>
    </html>
    <script language="VBScript">
        Recordset1.Close()
    </script>
     
  8. Other Things to Add If Needed

    You're probably thinking, ok so all this does is display information from a database. I want to use this page as a template for lots and lots of information. What if I want to send this page a Product ID number or other variables that should help me determine what information to display from my new database. Here's how...

    Add this somewhere before your database call in your <script></script> tags:

     Dim ProductID
            ProductID = split(Location.href, "=")
            
            
    Then down in your database call add as part of your where clause:
     "... WHERE ProductID = " & ProductID(1) 
            
            

    When you used the split function above, you in essense created an array of variables. Product(0) contains your variable name like &quot;ProductID&quot;. Product(1) should contain the actual number you wanted. For example, if you wanted to reference this page by:

        thispage.htm?ProductID=123
        
    ProductID(1) will contain the number 123. Since everything starts numbering at 0 :-) you can reference all your variables in your query string by referencing the odd numbers (i.e. ProductID(1), ProductID(3), etc.)

     
  9. Burn Away!
    Pay close attention to Step 3 in regards to where you should place your database on the CD-Rom. Currently the code should work if the database is on the root directory of the CD-Rom. If it resides elsehwere, just change the code to parallel your changes.

If you see anything wrong or need help with something in this tutorial, give me a shout.

About Azurite Design( visit site - I have other tutorials there too. )

Robbie Smith founded Azurite Design in 2002. This consultancy started out as helping friends and family get small personal web sites up. One of the most recent ones include Freelance College. You can see what he did in the Case Study.

The business grew slowly but steadily. Azurite Design targets small business owners who want a web presence or need help improving a current design. Azurite Design does not believe in charging exuberant gobs of money for the simplest details. We believe that our prices are very competitive and reasonable.

Azurite Design Specializes in back end programming and coding. Together, we can accomplish: Web Design, add back-end database management, capitalize on cd-rom catalogs, explore eCommerce, discover data warehousing, investigate Intranets, examine Extranets, master mailing lists, and search surveys. We test all our products for consistency and accuracy across all computing platforms, and all available current browsers.

Give us a call at 830-625-4276 or email us and together, we'll do whatever your heart desires or do whatever it takes to get you there.


Educational Experience

Robbie received a Bachelor of Science in Computer Science in 2001 from Texas State University with a minor in Mathematics. On a humorous note, his Calculus III class did not make due to lack of of interest.

He is now in the middle of a Masters in Information Systems Management from Keller Graduate School of Business Management through DeVry University. His coursework includes:

Accounting and Finance
Managerial Use and Analysis
Leadership and Organizational Behavior
Managing Organizational Change
Systems Analysis, Planning and Control
Database Concepts
Strategic Management of Technology
Database Applications for Electronic Commerce
Client/Server Applications
Networking Concepts and Applications
E-Business Security
Visual Basic
Internet Oriented Programming
Project Management Systems
Advanced Program Management
Overall GPA: 3.75 (after 8 courses)


Staff

President and Founder - Robbie Smith

Robbie, or Rob as he likes his friends (i.e. You) to call him by, started experimenting with computers and the Internet at the young age of 14 using SimpleText on an old Macintosh Quadra 630. In case you don't know of this computer, it was the last computer Macintosh ever made that didn't include the CD drive as a required item. He purchased a blazingly fast 4x speed drive a few months later seeing the demand grow.

The very next day after High School, he ventured off into college; didn't even take the summer off. He studied at Texas State University. Four years later, a Bachelor of Science in Computer Science, and one very cool Disney Internship, he went into the world.

Two years had passed working in the trenches and learning the ropes of the corporate environment, the hunger for education kept reappearing. He was accepted into the Keller Graduate School of Business Management to pursue an MISM (Masters of Information Systems Management). He's half way through the program and has earned a 3.75 GPA after 8 classes.

Wife and Assistant - Ilana Smith

Ilana (pronounced e-lawn-a), grew up in Delmas South Africa. She met Rob on the Disney Internship and got married 10 months later. She loves to bird watch and study biology. She has a degree in Wildlife Management with an Honors degree in Zoology.

Santa's Little Helper - Savana Smith

Currently, Savana is a little fire ball. She has 6 teeth and loves to blow rasberries on everything. It really tickles on the stomach. When she can, she'll have a career here if she so chooses.

php vs ms products

Submitted by dusoft on July 9, 2003 - 03:59.

I recommend PHP to everyone, since it offers better possibilities in comparison with VB Scripting, ASP. If you know SQL, also MSSQL won't suit your needs, they are somehow far from SQL standard, just check MySQL (www.mysql.com) What I propose is to download some kind of PHP IDE, easy php will do - http://www.easyphp.org/ for local testing purposes i prefer apache, php and mysql. however IDEs such as easyphp is pretty cool for presentation needs, since it's easy to install. I still don't understand after looking at ASP, why would anybody use it?

login or register to post comments

The Reason Why

Submitted by rob.smith on July 9, 2003 - 05:46.

I also like working with PHP and I whole-heartedly agree with you that's a powerful alternative. We were trying to develop a new product catalog for our company and I decided to try something new. Since our current online catalog is database driven, what's to stop me from doing the same on a CD? Our current version of the catalog relies on a SQL/ASP combination in part because we're running a Windows network. So I whipped out the manual, studied a bit and found a solution (see article). I thought if I could pull this off, then my time in maintenance for the catalogs in general would significantly be cut. I won't be maintaining multiple versions of the same catalog, just one. I've done well to improve this. We were doing about 21 catalogs all very similar. I got that number down to 3. I suppose that will have to do. The catch with the above example is that for every CD you make; you need to have a license for Microsoft Access. At $2M for 5K CD's, I found another solution. But the idea is neat non-the-less and that's why I chose to share it.

login or register to post comments

How about Flash?

Submitted by mr_cheapo on July 9, 2003 - 08:18.

I recently worked on a similar project, and we devised a different solution. Our front-end was Flash instead of HTML, so we created a ColdFusion (though this could be in PHP/ASP/whatever) script that translated our database into a plaintext file which we then include in the Flash actionscript. If the CD detects a net connection when it's inserted, it runs some CFM scripts on our webserver and gets the data that way. If there is no net connection, it grabs the data from the actionscript text. I suppose the main difference between our method and rob's is just that we're using actionscript instead of vbscript to parse the data. Having the data inside a flash file adds a nice layer of security however, if you don't want end users poking around in your database!

login or register to post comments

What happens if the browser in use is not IE?

Submitted by eli on July 10, 2003 - 04:56.

If the script language is VBScript is this compatible with other browsers that the user may have on his or her machine? Could other database types (i.e. MySQL, PosteGreSQL, etc) be used ? If so, would use of these negate the licensing problem?

login or register to post comments

The Idea...

Submitted by flukesh on July 10, 2003 - 12:18.

The idea is that content is dynamically generated without server-side processing. So you prefer PHP--that's great for your dynamic website, but try to program PHP in < script > tags. Other ways of pure client-side dynamic content are to use XML as your datafile, and use Flash (MX and v.5 both handle XML, but MX handles it better), or, you could use the XML DOM in script, whether JavaScript or VBScript. I find it amusing that comments turned to an ASP vs. PHP discussion, which is not relevant at all to the point of the article.

login or register to post comments

Two issues

Submitted by bardsley on July 21, 2003 - 01:04.

Firstly that's great for display but I always think that the thing that you want to show off is update and editing which *would* be impressive. In addition MySQL doesnt support SQL it is (unless I am mistaken) without transactions still. I suggest postgreSQL which has all the power of MS SQL and it's free and properly SQL compliant

login or register to post comments

The Idea... (Part II)

Submitted by flukesh on July 26, 2003 - 18:43.

The idea (again) is that we are dealing with dynamica data on a CD-ROM. Note: NOT running any type of database server like MySQL or postgreSQL. Am I missing something?

login or register to post comments

The access keys for this page are: ALT (Control on a Mac) plus:

evolt.orgEvolt.org is an all-volunteer resource for web developers made up of a discussion list, a browser archive, and member-submitted articles. This article is the property of its author, please do not redistribute or use elsewhere without checking with the author.