A Different Type of Lab
We've been writing a lot of programs and creating files. Now, it's time to kick things up a notch (bam). Every webpage you look at with a browser is a file you have downloaded to the computer you are using. This is a very powerful idea.
We will create files using a text "markup" language called html so that we can have them look nice in a web browser. You will be given a template in html; all you have to do is change it slightly.
~/public_html
is special to software looking for web pages. Any and all files that you put into
this directory can become available on your web page. (If your user id
is foobar, your web page is http://udel.edu/~foobar). If the
web browser finds a file there called index.html, it automatically
displays that file.
To see if you have this directory, change your working directory
to your home directory and then see if the directory
"public_html" is listed. If you don't have the
directory already, create the public_html
directory.
public_html
directory and create a
cisc105 directory. The public_html/cisc105
directory
will store your CISC105 web page. In a later step in this lab, you
will create a personal web page (if you don't already have one) and a
web page specifically for this course.
The files for your personal web page go into the directory "~/public_html", and will be accessed via the URL http://udel.edu/~userid (where userid is your UDelNet ID).
The "CISC105 web page" goes into the folder "~/public_html/cisc105", and will be accessed with the URL http://udel.edu/~userid/cisc105. You can use this same technique to create as many web pages as you like under your main web page, just by creating new subdirectories to store the content.
<html> <head> <title>Sara Sample's Web page</title> </head> <body> <h1>Sara Sample's Web page</h1> I had to do this <b>web page</b> for my <a href="http://www.udel.edu/CIS/105/tharvey/06F/index.html">CISC105 class</a>. Right now it is pretty lame, but I hope to make it better later. </body> </html> |
Here's what that looks like once it is formatted by a web browser:
Sara Sample's web pageI had to do this web page for my CISC105 class. Right now it is pretty lame, but I hope to make it better later. |
chmod a+rx ~/public_html/*
More details:The asterisk in the above command matches every file name in the public_html directory. You can also use chmod on individual files and directories by replacing the asterisk with a single name. You need to repeat this command each time you add new files under public_html that you want users of the Web to be able to access. chmod is short for "change mode", where the "mode" of a file is the part that specifies who can edit/read/execute the file. To see file modes, use the shell command "ls -al".
http://copland.udel.edu/~userid
If it
doesn't come up, make sure you set all your file permissions
correctly. The most common problem is not changing permissions
correctly. If you try that again, and it still
doesn't work, check with your TA or with a classmate for help. Be
sure to understand how to use the chmod command on both files and
directory names.
<img src="imagename.jpg">
, where
"imagename.jpg" is the (case-sensitive) name of your file. The
browser will then include the pic in your page. If the picture
doesn't show, check the file name, directory, and permissions.
Terry Harvey. Parts of this lab were borrowed from Phill Conrad with permission.