Hi there,
I can provide you with a web page that does exactly what you'd like
(including the date display). This, however, is impossible using
strictly HTML. There are many programming languages that could do
what you're requesting, but perl is the most common for this kind of
task. Thus, the following is the answer using perl:
==If you have 'Server Side Include'==
Step 1:
Download the following file and unzip the content ga.pl
http://www.maxlin.ca/tos/ga/ga.zip
Step 2:
Put in the following line in the HTML file whereever the list of links should go:
<!--#include virtual="ga.pl" -->
If the file name is "041203Article 1.html" it will display "04/12/03 - Article 1"
Step 3:
Save the HTML file as .shtml (this is so that the server knows it's
Server Side Include)
Step 4:
Put the SHTML page that you want the list to appear on, the articles,
and the file ga.pl in the same folder.
During this step, you should CHMOD ga.pl to a value of 755. You can do
this using an FTP client when you upload it to your server.
Also, please note that at the top of the perl file (ga.pl) it says
#!/usr/bin/perl
#
This may need to be changed depending on your server. You will need
to ask your server administrator for this detail if it does not work.
For a sample of the final product, please refer to http://www.maxlin.ca/tos/ga/
==If you do not have Server Side Include==
If you do not have SSI, I will need to see your index.html so I can
insert it into the perl file. The html would basically have to be
copied and pasted into the perl file so that the perl file produces
the static index file, with the dynamic links in the middle.
If you have any problems, or need any additional information, please
let me know; I will be more than happy to help you until you are
completely satisfied. Please use the "Request for Clarification of
Question" feature on this page for further questions.
Best regards,
Tox-ga |
Request for Answer Clarification by
joe_d-ga
on
28 May 2004 15:44 PDT
Well, I love your solution as it appears on the sample, but I can't
get the perl script to work properly. I uploaded a half dozen html
pages to a clear folder on the server, then uploaded the shtml file
and the ga.pl file, set the CHMOD on the ga.pl file to 755 and the
resulting html page appears to be displaying the included file instead
of executing it. Here is the link:
http://acorn.he.net/~rotaryc/Highlands/index.shtml
I checked, and Hurricane electric (www.he.com) uses #!/usr/bin/perl
for the top of the perl file.
I must be missing something simple.
Joe Donohue
|
Clarification of Answer by
tox-ga
on
28 May 2004 17:21 PDT
I took a look at the HE page for server-specific details on running scripts.
I think that your server will only run scripts in the /cgi-bin
directory; that is, http://acorn.he.net/~rotaryc/cgi-bin so you should
move the perl file to that directory. Remember to check that it is
still chmod'ed to 755 after the move.
You should change the reference in the SSI command in the index.shtml
file appropriately, like <!--#include virtual="../ga.pl" -->
If that doesn't work, you could try changing it to <!--#exec
cmd="/home/rotaryc/cgi-bin/ga.pl"--> (it may be /home/~rotaryc...)
If none of these work, let me know.
|
Request for Answer Clarification by
joe_d-ga
on
28 May 2004 19:35 PDT
Wow, this has turned out to be a hassle but please stick with me. I
tried as many permutations of your suggestions as I could think of. I
created the files Index.shtml through Index6.shtml without success.
They are on the same link.
Here is what I included in each:
Index.shtml <!--#include virtual="ga.pl" -->
Index1.shtml <!--#include virtual="/~rotaryc/cgi-bin/ga.pl" -->
Index2.shtml <!--#include virtual="../ga.pl" -->
Index3.shtml <!--#exec cmd="/home/rotaryc/cgi-bin/ga.pl"-->
Index4.shtml <!--#exec cmd="/home/~rotaryc/cgi-bin/ga.pl"-->
Index5.shtml <!--#exec cmd="ga.pl"-->
Index6.shtml <!--#include virtual="/rotaryc/cgi-bin/ga.pl" -->
The first produces a listing of the pl file
The 2nd,3rd and 6th produce [an error occurred while processing this directive]
The 4th and 6th produce Content-type: text/html
The 5th produces a blank
I am sorry to keep on this but I really want to make it work.
Joe Donohue
|
Request for Answer Clarification by
joe_d-ga
on
28 May 2004 20:34 PDT
It appears that Index3 and 5 are working in that the file ga.pl is
actually being accessed, but none of the html files are being
displayed.
Joe
|
Clarification of Answer by
tox-ga
on
28 May 2004 22:02 PDT
Hey,
Don't worry, we'll get this working. Perl can be tricky the first
time you install a script on a new server, but I've done it dozens of
times so I know all the possible things that could go wrong and their
solutions.
It is great that 3 and 5 work. In fact, I am sure I have the answer.
I can't see the links you posted though. I think your server only
lets you view folder contents because all I see is "file not found".
In any case, when I told you to move the perl file to the /cgi-bin
directory, I forgot that the perl file checks the directory it is in
for .html files.
There is a line in ga.pl that reads:
opendir DIR, "." or die "Can't open directory $dir: $!\n";
I would like you to change it to:
opendir DIR, "../Highlands" or die "Can't open directory $dir: $!\n";
That way, it will check the Highlands directory for html files in the
yymmddDescription.html format.
This should work with 3 and 5, the ones that already worked, but if it
for some reason doesn't, please don't hesitate to ask me again.
Cheers,
tox-ga
|
Clarification of Answer by
tox-ga
on
28 May 2004 22:03 PDT
Oh, and also I should remind you to CHMOD the file again when you
upload the changed version. I've wasted hours chasing little things
like this before.
|
Request for Answer Clarification by
joe_d-ga
on
29 May 2004 08:10 PDT
I knew this would happen. The original solution you sent would have
worked except for the fact that I specified the files as html when
they were actually htm.
I could not get any variation of the
<!--#include virtual="ga.pl" -->
to work, but I was able to get the
<!--#exec cmd="ga.pl"--> to work fine, so the pl file did not need to
be in the cgi-bin directory after all.
Then, I complicated things by sending you the wrong link. I had
incorrectly named the directory "HIghlands" (with a capital "I") I
fixed that and here is the correct link:
http://acorn.he.net/~rotaryc/Highlands/
The index1.shtml file works.
Now, for 2 final things:
1. I don't seem to be able to unhook the "Content-type: text/htm" from
the first listing, and
2. How can I adjust the pl file to sort backward (latest item first)?
I changed the order of the printout to print $2, $3, $1 to display in
normal date sequence but I just need to have them sorted backwards.
Thanks
Joe Donohue
|
Clarification of Answer by
tox-ga
on
29 May 2004 11:58 PDT
Hi Joe,
I'm glad we got this all working properly. As for reversing the
order, this has a simple fix:
The line reading:
@files = sort @files;
should be changed to:
@files = reverse sort @files;
As for the printed Content-type header, I'm surprised that it is
showing up. My first suspicion is that it should read:
Content-type: text/html\n\n
even though you are using .htm files. 'text/htm' is not a valid
content type as far as I know. However, that would suggest that your
server fixed the script on its on by adding a content-type header when
no valid ones were found.
So, my suggestions to you are this:
1) Change the part reading
print "Content-type: text/htm\n\n";
to
print "Content-type: text/html\n\n";
2) If this results in 'Content-type: text/html' being printed at the
top of the page still, then I would suspect that your server
automatically adds headers, so the one we're printing is redundant and
you should try removing the line altogether.
After these steps, eveeything should work perfectly. However, these
are computers we are talking about, so we can never tell. If
something doesn't work right after this, you may of course feel free
to ask me for help.
Best regards,
tox-ga
|