About Server Side ProgrammingBefore starting this lesson, please make sure you fully understand the principles we covered in all of the previous lessons because we will begin "chopping" MYSITE into functions that will be used over and over for each new page created. ***In order to continue, you will need to have access to a server with PHP running on it.*** The Drawback of Static HTMLSo far we have designed our default.html by directly creating the HTML tags that a visitor's browser can relate to. We could simply rename default.html to another name like PAGE_TEMPLATE,html and use it as a template to create a new page like about_us.html or links.html. We could quickly create an entire website this way. It would be easy to simply use the page template and "save as" a new html file name. Using the template to create new pages with the area where the specific information for that page was simply left blank. But envision this. After your MYSITE is up and running on the web for about 2 months, you discover that you need to add another link to the menu on the left. By now your site has grown to 5 pages for links alone (since you decided to create a separate page for each category of link you wanted to display)... And you have 30 pages of articles you have written, each created from your template. You now have 35 pages that need the menu addition. I am being conservative here, because websites have a way of growing exponentially beyond belief! But suppose it only takes you 3 minutes to pull up each page, add or change the new menu item and go to the next page to change. You (or someone you pay) has just eaten up an hour and a half of time. The solution is to let your server do the work.
Benefits of Server Side ProgrammingUnlike HTML and scripts like Javascript (which won't work anyway, if the visitor has disabled it), which are processed by a visitor's browser, server side programming is processed at the server level and the appropriate HTML is dynamically created by the server itself. You can view the HTML in most web pages by simply clicking on a browser toolbar, choose tools and then view source or source code. Since server side programming is executed at the server level, the actual server side code is never available to the public... only the HTML or Javascript it outputs to a visitor's browser. So right from the gitgo, using a server side language to do web pages adds security. For example, instead of your email being displayed for the world to spam, you can use an almost spam proof email form that prevents any direct access to your email address. Your server can take the messages, check them for validity and then if a message meets the criteria you set... passes the message along to your email box. All behind the scenes where no one can mess with you. PHP and ASP are two popular server side programming systems. We use PHP because it is fast, reliable, free, and runs equally well on Windows, Unix and Linux based servers. Your easy managed website will only be accessing a few of the functions available in PHP, but your website will inherently have all the powerful features of server side programming.
|