Web site layout - Chapter 4: Architecture of an Intranet Application .

Chapter 4: Architecture of an Intranet Application . apiVersion(): This is a utility method that returns the version number of the DBI object. The DBI abstraction class enables you to connect to any database and perform any SQL query, such as SELECT, INSERT, UPDATE, DELETE, and so forth. Because it hides the database vendor-specific details from your application, porting to other databases become a much easier task. Now let s look at how we can develop an error handler class. Creating an Error Handler Class Every application needs to display error messages. In the old days, error messages were usually hard-coded in the executable programs and were very difficult to understand, let alone modify! Now, in the days of Web interface, we should not resort to the old way of showing hard-coded error messaging because the application can be used in so many parts of the world. Error messages written in English are just not friendly enough for the world in this Internet age. So applications that have internationalizable error message support will have broader reach. Listing 4-2 shows an error message handler, which loads and displays error messages in the application s default language. Because an application s default language can be changed in the configuration file, it becomes very easy to display error messages in different languages. Listing 4-2: class.ErrorHandler.php * @access public */ define( ERROR_HANDLER_LOADED , TRUE); class ErrorHandler { function ErrorHandler($params = null) { global $DEFAULT_LANGUAGE; $this->language = $DEFAULT_LANGUAGE; Continued

Leave a Reply