New Graduate Student Seminar Series
The <a>...</a> Tag ... The Backbone of WebPages
<a href="filename"> </a>
- This is the tag in HTML that creates a hyperlink to another Web page.
- There are four general types of links distinguished by the location of the file you are linking to:
-
- Specifying a URL for a file in the same directory:
<a href="filename.html">Text you want user to see</a>
The previous code produces a link that appears as: Text you want user to
see
- Specifying a URL for a file in a subdirectory:
<a href="subdir/filename.html">Text you want user to see</a>
- Specifying a URL elsewhere on the same server: (Note beginining slash)
<a href="/activities/activities.html">Outdoor Activities</a>
The previous code produces a link that appears as: Outdoor
Activities
- Specifying a URL for a file on another web server:
<a href="http://www.theregister.co.uk/2002/05/19/ms_in_peruvian_opensource_nightmare/"> M$ in Peruvian
open-source nightmare</a>
The previous code produces a link that appears as: M$ in Peruvian open-source
nightmare from The Register.
Other uses of the <a>...</a> tag
- Creation of an email link:
Please <a href="mailto:jarek@math.montana.edu_NOSPAM">email me</a> with your math questions.
The previous code produces a link that appears as: Please email
me with your math questions.
- The a href tag is also used to link to postscript and pdf files:
PDF version of <a href="/~griff/m182/quiz/quiz7.pdf">M182 quiz 7</a>
The previous code produces a link that appears as: PDF version of M182 quiz 7
- The NAME attribute is used to specify links within a page.
The links look like: <a href="#bottom">Bottom of the page</a>
The previous code produces a link that appears as: Bottom of the page
The NAME anchor ( <a name="bottom"> ) must be set where you want the browser to
land.
OR another use: <a href="web_2.html">Return to Top of the page</a>
The previous code produces a link that appears as: Return to Top of the page
Note, unlike other attributes, NAME is
case-sensitive.
- The Target attribute is mostly annoying. but occasionally there is a use like:
<a href="/help/images/isaac.jpg" TARGET="NewWindow">Isaac</a> at a recent conference
The previous code produces a link that appears as: Isaac at a recent conference
Server Side Includes
HTML uses the names <tag attribute="argument"> whereas SSI uses <!--#command argument="value"-->.
No spaces are allowed between the opening delimiter <!-- and the start of the command. Similarly,
between the end of the command and -->, no spaces are allowed.
The result should look like this:
<!--#configfile="filename.htm"-->. Failure to follow this simple rule will result in the server seeing a <!-- comment
--> instead of what you intended.
Example:
This is the time & date command: <!--#echo var="DATE_LOCAL"-->
Tuesday, 12-Feb-2013 06:21:31 MST
The following is a list of the various commands that are documented on the NCSA HTTP web servers.
- Include -- this is the one that will insert one HTML file into another.
-
- Same Directory syntax: <!--#include file="schedule.html"--> Returns: (see
below)
- Different Directory syntax: <!--#include virtual="schedule.html"-->
- Config -- changes some server default responses, also sets date formats.
The function of the config command is to "adjust" the server's responses to other commands. It takes two parts, the config
command then the actual server command. Both must reside inside the same HTML page.
- echo -- The echo command works only with one argument, "var=". However, the argument takes a wide variety of values.
Examples:
-
- <!--#echo var="LAST_MODIFIED"--> Returns: Tuesday, 14-Jun-2011 16:52:16 MDT
- <!--#echo var="DATE_LOCAL"--> Returns: Tuesday, 12-Feb-2013 06:21:31 MST
- <!--#echo var="DATE_GMT"--> Returns: Tuesday, 12-Feb-2013 13:21:31 GMT
- <!--#echo var="DOCUMENT_NAME"-->Returns: web_2.html
- <!--#echo var="DOCUMENT_URI"-->Returns: /help/build_pg/web_2.html
- <!--#echo var="REMOTE_ADDR"--> Returns: 171.67.65.203
- <!--#echo var="REMOTE_HOST"--> Returns: (none)
- <!--#echo var="REMOTE_USER"--> Returns: (none)
- fsize -- returns the size of the stipulated file. Note, the output can be modified by the config command.
-
Same Directory syntax: <!--#fsize file="web_2.html"--> Returns:
11K
Different Directory syntax: <!--#fsize virtual="../images/isaac.jpg"-->
Returns: 68K
- flastmod -- returns the last modified date and time of the stipulated file -- also modified by the config command. (This
command does the same job as the echo command's var="LAST_MODIFIED" argument and value.
Same Directory syntax: <!--#flastmod file="web_2.html"--> Returns:
Tuesday, 14-Jun-2011 16:52:16 MDT
Different Directory syntax: <!--#flastmod virtual="../images/isaac.jpg"-->
Returns: Tuesday, 14-Jun-2011 16:52:16 MDT
A Final comment: When the page loads, the commands are executed, and assuming no errors are encountered, what appears when
you view the source is the execution of the SSI not the actual command.
A Useful Example - using both SSI and Tables
The following code: <!--#include file="schedule.html"--> (or <!--#include virtual="schedule.html"--> in the
target file is in a different directory) Will insert the file schedule.html below. Again, I point out,
simply putting a space between the open delimiter "<--" and the "#" will turn the SSI into a comment.
[an error occurred while processing this directive]


Last Modified: Tuesday, 14-Jun-2011 16:52:16 MDT