Home

Forum | News | Getting Started | How to | Hello World | Reference | Archive | Downloads | Contact | FAQ
Extend Your Business
Hello World

Here you'll find a simple example that helps you to understand the idea of dynamic content in "static" HTML sites.

Hello World .. the basics

As found nearly everywhere we will provide a very easy sample named "helloworld.js". This example jsut demonstrates how the ServiceInclude works. It doesn't display any real dynamic content, but you can easily extend this example.

sm2-1002-de.gif

sm2-1002-de.gif

As you can see, this example takes up only three lines of code. It defines a simple JavaScript function that, when being called, will display a MessageBox saying "Hello World".
Now, let's have a look at how to use this example with SmartStore 2000 Express.

The idea is to display the "Hello World" message when a customer visits the start page of a SmartStore OnlineStore. So we actually have to place the ServiceInclude in the snippet file, that contains the information for the start page. This information can be found in the "start.snp" file, located in the "body" folder in your template directory.

There are just two things to do: Place the ServiceInclude in the "start.snp" snippet, and do the function call, that will invoke the "HelloWorld" function.

sm2-1002-de.gif

sm2-1002-de.gif

Place this text into your "start.snp" file, and enter the right path to your helloworld.js include, or you can also use the file stored in the samples folder ( https://commerceforum.tripod.com/samples/snphelloworld.js )

Now, all you have to do, is to re-create your store, and open it in your browser, and if everythign went fine, you should see a little message, whenever you open the start-page of your store.

But that's stupid?!?

Of course you can say that things could've been done easier than that. You don't really need a ServiceInclude to display a stupid message like "Hello World". Of course not!

This was just the demonstration of the basic functions. Later on, we will see how to create dynamic includes based on ASP, and maybe even CGI ( when I have the time to do that ). We will learn how to actually establish a two way communication between store and service include.

By using ServiceIncludes you can even exchange data between the store and an online database as easy as.

Copyright 2001 - 2003, Marc Ernst, Germany -- Other Authors: Michael Elwers, Germany -- The authors do not take any responsibility for the codes published on this website. The authors cannot be held responsible for any damage.