One of the first tasks when planning a website is to develop a strategy for delivering content and functionality to visitors.
Since a website is a collection of HTML documents, the most basic approach is to simply code the information you want into these documents. Using this method results in what is called a “static” website since the content and functionality is hard-coded and each visitor will see the same content every time he visits your site.
Dynamic websites
In contrast, a developer might choose to create a “dynamic” website, one where the content is either pulled from a database, another external source or even be generated on the fly. By creating a dynamic website, the content is regenerated every time a visitor goes to the site, allowing developers to include content that is customized to each visitor.
Dynamic website content is made possible by using scripting languages. A scripting language is a type of computer programming that allows a developer to create a series of tasks that are completed as a computer interprets the code. When dealing with website, there are two fundamental types of scripting languages — server side and client side.
A server-side scripting language is one that is processed by the server, usually after a request has been made but prior to sending information back to the visitor making the request. Some common website scripting languages are PHP (Hypertext Preprocessor), ASP (Active Server Pages), Python and Perl. Server-side scripts require their own code, which is placed in the document on the server. When a user makes a request for a web page, rather than simply sending the document out to the user, the server processes the scripts in that document first, injecting the results of the script into the HTML stream that is sent to the user who requested it. For example, scripting languages are integral in accessing a database to retrieve content. After the user requests the page, a script is executed which queries the database and formats the results before injecting that content into the proper place before sending an HTML stream back to the user.
Client-side script
A client-side scripting language is one that is processed by the user’s computer, usually providing some sort of functionality that makes the user’s experience more pleasant. Client-side scripts are sent from the server to a user’s web browser and executed when called for. Since all of the scripting code is passed to the user and executed on the user’s machine, requests to the server are not required. A common use for clientside scripts is to validate the information that a user has submitted in an online form. Rather than using server resources to validate this data, a client-side script can be executed when the form is submitted that will examine the data before it is sent to the server. In this way, server resources are not being consumed by validating forms as that task is performed before the server even gets a request.
Scripting languages can be intimidating at first. However there are many resources out there from which to learn and any developer who intends on building ecommerce websites will eventually need to embrace scripting.