A Method To Minimize HTML Code Duplication

Slides:



Advertisements
Similar presentations
CS 22: Enhanced Web Site Design - Week 8Slide 1 of 15 Enhanced Web Site Design Stanford University Continuing Studies CS 22 Mark Branom
Advertisements

CGI & HTML forms CGI Common Gateway Interface  A web server is only a pipe between user-agents  and content – it does not generate content.
1 Configuring Internet- related services (April 22, 2015) © Abdou Illia, Spring 2015.
Master’s course Bioinformatics Data Analysis and Tools Lecture 6: Internet Basics Centre for Integrative Bioinformatics.
Creating WordPress Websites. Creating a site on your computer Local server Local WordPress installation Setting Up Dreamweaver.
Apache Tomcat Server – installation & use Server-side language-- use Java Server Pages Contrast Client-side languages HTML Forms Servers & Server-side.
Apache Tomcat Server Typical html Request/Response cycle
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
Chapter 4 Mixing PHP and HTML  In this chapter, you’ll learn how to do the following: -Recognize and use the different kinds of PHP start and end tags.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
CGI Common Gateway Interface. CGI is the scheme to interface other programs to the Web Server.
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
Server-side Scripting Powering the webs favourite services.
1 In the good old days... Years ago… the WWW was made up of (mostly) static documents. –Each URL corresponded to a single file stored on some hard disk.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
1 © Copyright 2000 Ethel Schuster The Web… in 15 minutes Ethel Schuster
CGI Common Gateway Interface. CGI is the scheme to interface other programs to the Web Server.
SSI “Server Side Includes” SSI defined Server Side Includes (SSI) are HTML comment tags which contain commands directed at the Web server. The server.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
Introduction & Overview Introduction to PHP - Fort Collins, CO Copyright © XTR Systems, LLC Introduction to & Overview of PHP Instructor: Joseph DiVerdi,
PHP “Personal Home Page Hypertext Pre-processor” (a recursive acronym) Allows you to create dynamic web pages and link web pages to a database.
Server Side Scripting Perl, Python, Java Servlets  write complete programs in (Perl, Python, Java) to process HTTP requests and generate a complete HTTP.
Servers- Apache Tomcat Server Server-side scripts- Java Server Pages.
 Before you continue you should have a basic understanding of the following:  HTML  CSS  JavaScript.
Introduction to Server Side Includes Fort Collins, CO Copyright © XTR Systems, LLC Introduction to Server Side Includes (SSI) Instructor: Joseph DiVerdi,
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
Chapter 8 E-Commerce Technologies Introduction to Business Information Systems by Mark Huber, Craig Piercy, Patrick McKeown, and James Norrie.
What’s Really Happening
National College of Science & Information Technology.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
PHP using MySQL Database for Web Development (part II)
PHP 3.
Tonga Institute of Higher Education IT 141: Information Systems
JavaScript and Ajax (Ajax Tutorial)
CSE 103 Day 20 Jo is out today; I’m Carl
Section 6.3 Server-side Scripting
Web Concepts Lesson 2 ITBS2203 E-Commerce for IT.
WWW and HTTP King Fahd University of Petroleum & Minerals
Technologies and Applications
JSP (Java Server Page) JSP is server side technology which is used to create dynamic web pages just like Servlet technology. This is mainly used for implementing.
Authentication & .htaccess
Active Server Pages Computer Science 40S.
CNIT 131 Internet Basics & Beginning HTML
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
Troubleshooting IP Communications
PHP / MySQL Introduction
MapServer In its most basic form, MapServer is a CGI program that sits inactive on your Web server. When a request is sent to MapServer, it uses.
Intro to PHP & Variables
Module 3 Building a web app.
Tutorial (4): HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
IS333D: MULTI-TIER APPLICATION DEVELOPMENT
The Request & Response object
Client side & Server side scripting
Tonga Institute of Higher Education IT 141: Information Systems
Configuring Internet-related services
Chapter 2 Interacting with the Customer
JavaScript.
PHP and Forms.
Lesson 1 The Web.
Tonga Institute of Higher Education IT 141: Information Systems
Enabling CGI & PHP With Apache
Intro to PHP.
Server Side Includes Server Side Includes (SSI) are simply this:
INFS 230 L Internet Technology
Client-Server Model: Requesting a Web Page
Information Retrieval and Web Design
Web Servers (IIS and Apache)
Introduction to JavaScript
Web Application Development Using PHP
Presentation transcript:

A Method To Minimize HTML Code Duplication Server-side Includes A Method To Minimize HTML Code Duplication

What Is SSI? Server-side Includes (SSI) are a collection of commands you can use to make web pages more dynamic You can use SSI to: Include another HTML file at a specific point in a file Display when a specific file was last modified Display information about the environment in which this page is generated For example: include the HTML code for a common footer that appears on all pages.

So, What Really Happens? The Web uses a “request/response” architecture The “normal” process is: The browser sends a request to the server The server locates the requested HTML file and reads it The server sends the HTML code to the browser Request Response

And…? With SSI, there is a slightly different process The browser sends a request to the web server The web server locates the requested file The web server reads the requested file The web server locates and executes any SSI directives found in the file The web server replaces the SSI directive in the file with the result of that directive’s execution The web server sends the resulting HTML to the browser

SSI in Action Request Sent Locate File Respond with the Updated File Read File <body> <div id=header) … <!—SSI--> </div> <body> <div id=header) … <div id=“footer”> Copyright © 2010 All rights reserved </div> Locate File to Include SSI in Action <div id=“footer”> Copyright © 2010 All rights reserved </div> Replace the SSI directive with the included file

When Will the Server Look For SSI? The “trigger” that tells the server to search for and process SSI directives will vary from server to server We are using an Apache server on Banjo Apache has three ways it can be configured to look for SSI directives: Parse all the files processed, looking for SSI directives Parse only those files with an .shtml extension Parse any .html files that have the execute bit set in the file permissions UNDERLINED bullet is how Banjo does it.

SSI Includes Of all the SSI directives, the ability to include the content of a file within another file is the most popular There are two ways in which to include a file: The include file directive – used when we can specify the file in the current directory or lower The include virtual directive – used when we need to go outside the current directory The file must be on the same server

“Including” an Example … <div id=“sidebar”> … </div> <footer> <!--#include file="includes/footer.html"--> </footer> </body> </html> For this code, the server would locate the file footer.html in the includes subdirectory The server would substitute the contents of footer.html for the #include directive The directive: <!--#include virtual="includes/footer.html"--> would achieve the same result If we needed to go outside the current directory, we’d need to use virtual: <!--#include virtual=”../includes/footer.html"-->

But Wait… There’s More! SSI is not limited to only including one file in another! SSI has many commands that can report on the environment in which a page is processed SSI can also give us information about the pages themselves

SSI and the Environment As a quick exercise, create a web page named: system.shtml In the body of the page, include only this command: <!--#printenv--> Mount the page on Banjo and view it See if you can identify what the different parts or the report mean

More SSI directives Command Description <!--#echo var="DATE_LOCAL"--> Return the current date and time <!--#echo var="DOCUMENT_NAME"--> The name of the web page file containing this command <!--#echo var="HTTP_REFERER"--> The link you used to get to this page <!--#echo var="DATE_GMT"--> Greenwich Mean Time <!--#echo var="REMOTE_ADDR"--> The IP address of your computer! <!--#echo var="HTTP_USER_AGENT"--> Information about your browser and operating system <!--#fsize file="filename"--> The size of the named file in bytes <!--#flastmod file="filename"--> The date/time the named file was last updated Relate the variable names to the identifiers dumped with the #printenv command

Look at the examples In the example SSIDemo.shtml you see many examples of information you can obtain about the current page and the browser/server environment In the example SSIDates.shtml you will see: A way to use SSI to create a dynamic “backwards link” A way to modify how dates are displayed using SSI This technology is the basis for PHP, which you’ll be exploring in 330 (Rich Media Web App Dev I).

Try It Yourself! Today’s ICE will let you try using SSI to bring more dynamic information and content into your web pages