The link directory script enables you to maintain a categorized
listing of links on your site, where visitors can add their link, or
view links left by others.
Follow the steps below to easily add a link directory to your site.
Users familiar with HTML can fully customize the link directory page,
or add multiple directories to their site.
A link directory sample is available:
How to Add a Link Directory
Follow these steps to add a link directory to your web site.
- Create your link directory data file
- Create your link page
- Customize categories and page layout
Create Your Link Directory Data File
Use Notepad (or similar text editor) to open a new text file, and
enter the following line (replacing "linkpage" with your
preferred name for your HTML link page):
filename = /linkpage.html
Save the file as "filename.links.txt" (replacing "filename"
with your preferred name for the link directory data file).
Upload this file to your "freeCGI" directory, which is one level
above your document root ("htdocs"). Use
FTP or
Webby to upload your file
(you cannot access this directory with FrontPage).
Create Your Link Page
Create a new file called "linkpage.html" (replacing "linkpage"
with the exact same name you entered into the data file
above). This file should contain the following HTML (replacing "Link
Page" with your preferred page title, "filename" with the
data file name you provided above, and all instances of
"Category1", "Category2" and "Category3" with
your preferred link category names):
<HTML>
<HEAD>
<TITLE>Link Page</TITLE>
</HEAD>
<BODY>
<H1>Link Page</H1>
<FORM METHOD="POST" ACTION="/cgi-t/links.cgi">
<INPUT TYPE="hidden" NAME="file" VALUE="filename.links.txt">
Link
Title: <INPUT TYPE="text" NAME="title" SIZE="50"><BR>
Link
URL: <INPUT TYPE="text" NAME="url" SIZE="50"><BR>
Link
Category: <SELECT NAME="section">
<OPTION>Category1</OPTION>
<OPTION>Category2</OPTION>
<OPTION>Category3</OPTION>
</SELECT><BR>
<INPUT TYPE="submit" VALUE="Add Link">
</FORM>
<HR>
Category1
<!--Category1-->
<HR>
Category2
<!--Category2-->
<HR>
Category3
<!--Category3-->
</BODY>
</HTML>
Upload this file to your document root ("htdocs") directory.
Accessing Your Link Page
Point your browser to http://www.yourname.com/linkpage.html
(where "yourname" is your actual domain name, and "linkpage"
is the name of your new link page).
Visitors can submit their own link from this page, or view
categorized links that others have submitted.
Customizing Your Link Page
The above code sample is intended to provide a starting point for
your link page. Once you have verified that your link page is working
correctly, you can edit this page to match the appearance of your
site. You can use your preferred HTML editor, or edit the code
directly. Just remember to retain the above form action, field names,
and variables.
Adding Link Numbers and Timestamps
You can also include the following variables in your link page.
To display the number of links:
<!--number-->
To display a timestamp specifying when the link was added:
<!--time-->
Deleting Links
To delete entries from your link page, simply open the page using
FTP, Webby, or your preferred HTML editor, and remove the entries you
no longer require. When deleting links, be careful not to delete the comment
tags.
|