Browsers are notorious for rendering HTML pages perfectly even when a page contains errors. For instance, a button may display properly but not function because of a missing closing tag. Hence the need for tools to check syntax. This is relatively straightforward for static HTML pages but what about dynamic pages? When server-side technologies such as PHP or ASP are used to create HTML pages dynamically, checking and debugging the result can be difficult. This article will show how this can be done using the free text editor, HTML-Kit. This will involve configuring some of the features of this editor. No knowledge of any specific technologies is required but a general knowledge of HTML and of the function of browsers and web servers is assumed.
Using HTML-Kit to Debug Server-Side Scripts - Basics (Page 3 of 4 )
Something that you might want to pay immediate attention to is the file format setting on the "Save" tab of the preferences window. If you know that the server you are planning to upload your files to runs on a Linux or UNIX platform, then be sure to choose the UNIX file format. The reason for this is that different operating systems handle the return key in different ways. If you save your files in Windows format and later download them from a UNIX server, you will find that an extra carriage return has been inserted after each line. While this does not change your file's functionality, it can be annoying. As an additional note, having saved your HTML file in UNIX format, it will not display properly in Notepad. If you want to view it in a Windows text editor, use WordPad instead. If you do save it from WordPad, make sure you save it in text format.
I'll just point out that you can quickly access commonly performed tasks by adding them to "Favorites". If you right click a button on any one of the elements in the Actions Bar (the tabbed strip below the tool bar), a pop-up menu allows you to add this item to your favorites. When you become familiar with HTML-Kit and find that you repeatedly use certain capabilities, you will really appreciate this feature.
Exploring the other settings will certainly improve your efficiency with this tool but these are really the only settings you may need to worry about here.
Set Up the Server
Html-Kit needs to know where your server is located if it is going to process your server-side scripts. Again, this is configured from the "Preferences" menu option so open the preferences window and choose the "Preview" tab. In the frame entitled "Preview Rules" make sure that the "Enable Server Mappings" box is checked. Having done that, click the "Edit Preview Rules" button. Here you will add a server mapping. Clicking the "Add" button will open a dialog window and you will be able to add a File Path and a server address. If you are running IIS or PWS on your local machine the file path will be "C:Inetpubwwwroot". For the server address put "http://<your computer name>/" substituting the appropriate value for "your computer name" or, if you like, you may use "localhost". Make sure you click "Okay" to save your preferences. Now, whenever you preview files that are in a directory at or below the root directory of your server, they will be processed by your server. If your server-side script generates HTML the server will create it when you preview a file.
From the preferences window, choose the "Programs" tab. In the "Windows Integration" frame, click the button with the caption "File Associations, Explorer ...". For the "Internet Explorer (IE) 5+ Integration" option make sure that the "Use to View Source" box is checked. This will ensure that when we preview a file in HTML-Kit and then choose to view the source code of a page it will also be shown in HTML-Kit. Since we've already told HTML Kit to run this file through our local server, any server-side scripting will have been processed and output as HTML.