•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 397,771 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,541 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 10312 | Replies: 11
![]() |
•
•
Join Date: Mar 2005
Location: Everett, Wa (sub. north of Seattle)
Posts: 54
Reputation:
Rep Power: 4
Solved Threads: 0
I have setup a guest book on my brother's website Paul Owen Lewis and I want to change the way the entries look. Change the font, spacing, add a small icon to denote the beginning of a new entry, etc... kinda like This One. I believe to do this I need to edit the "guestbook.pl" file on my host server (and I have done this so far to edit the background, etc.) but I can't find anywhere that I would edit it to change the way the entries look.
The guestbook.pl file
Any I deas? Am I way off track here?
Thanks, RS
The guestbook.pl file
Any I deas? Am I way off track here?
Thanks, RS
•
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 107
Yes, You need to edit the CGI (the guestbook.pl) in order to modify the appearance of the entries. The thing to understand here, is that guestbook.pl actually edit's the html file that contains the guestbook entries. So, guestbook.pl opens the file polguestbook.html, and reads everything that's in it, into an array. Then, it modifies the information in the array (it adds a new guestbook entry), then it re-writes polguestbook.html back to the disk. If you want to try a little experiment, load the guestbook web page: http://paulowenlewis.com/guestbook/polguestbook.html, and then right click on the page and view page source. Hit F3 (find), and type in --begin
that's where the CGI (guestbook.pl) actually starts making changes to the file. In the CGI, search for: # Open Link File to Output
Everywhere below that where you see:
is actually where the entries are being added to the HTML file. So, you can modify those lines to contain fonts, tables, or images. This line, for instance:
is where it actually writes to the HTML file, what the user typed and submitted. So, you could remove the Bold tags, or add italics, or whatever you want in order to make it look the way you want it to. Let me know if this helps, or if you need further assistance.
that's where the CGI (guestbook.pl) actually starts making changes to the file. In the CGI, search for: # Open Link File to Output
Everywhere below that where you see:
print GUEST "whatever in here";
is actually where the entries are being added to the HTML file. So, you can modify those lines to contain fonts, tables, or images. This line, for instance:
print GUEST "<b>$FORM{'comments'}</b><br>\n";is where it actually writes to the HTML file, what the user typed and submitted. So, you could remove the Bold tags, or add italics, or whatever you want in order to make it look the way you want it to. Let me know if this helps, or if you need further assistance.
•
•
Join Date: Mar 2005
Location: Everett, Wa (sub. north of Seattle)
Posts: 54
Reputation:
Rep Power: 4
Solved Threads: 0
•
•
Join Date: Mar 2005
Location: Everett, Wa (sub. north of Seattle)
Posts: 54
Reputation:
Rep Power: 4
Solved Threads: 0
•
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 107
Sure Can. The command that the .pl file is using to get the date and time is the unix date command, which is found under /usr/bin, you can see that it refers to the path here:
Now, the date is actually called twice, in 2 different formats. A Short Format and A Long Format, Which is saved into 2 different variables here:
I don't know the version of unix that this page is being hosted on (or even if it is unix, maybe it's with windows with active Perl, I honestly don't know), but I know that it is different from the server I host mine on. If you have shell access, which I bet you can connect through SSH (Secure Shell) to the server, you can execute the linux command "man" which is a manual page. So: man date
will give you the manual page about the date command. On my server, It is as follows (on yours, I'll bet it's different):
Now mind you, that's on my server, the server hosting your page might use a different set of internal variables, I don't know. In order for me to get the date to appear like this: 04/20/05, I have to use a: date +"%D"
And it turns out perfect. Anyway, in the .pl file, it also writes to the .HTML file with a - before date. I'll be perfectly honest, I don't see where the time comes in to play before the - in the .pl file, unless you changed something on me recently in the .pl file and didn't update the .txt file to reflect those changes. But here are the lines that affect where the time and date are written to the .html file:
You can see that it uses a - right off the bat before adding the $date to the file, what I don't get, is where the time is printed in that, but I'm guessing some changes where made in the .pl file, not shown in the .txt. I hope this helps a little, if this seems fairly confusing, I apologize, just ask and I will help to break it down.
$date_command = "/usr/bin/date";
Now, the date is actually called twice, in 2 different formats. A Short Format and A Long Format, Which is saved into 2 different variables here:
# Get the Date for Entry $date = `$date_command +"%A, %B %d, %Y at %T (%Z)"`; chop($date); $shortdate = `$date_command +"%D %T %Z"`; chop($shortdate);
I don't know the version of unix that this page is being hosted on (or even if it is unix, maybe it's with windows with active Perl, I honestly don't know), but I know that it is different from the server I host mine on. If you have shell access, which I bet you can connect through SSH (Secure Shell) to the server, you can execute the linux command "man" which is a manual page. So: man date
will give you the manual page about the date command. On my server, It is as follows (on yours, I'll bet it's different):
%A Represents The Day Of The Week (Monday, Tuesday, Wednesday, etc) %B Represents The Month (april, may, june) %d Represents The Day Of The Month (19, 20) %Y Represents The Year (2005) %T Represents The Time (18:08:21) %Z Represents The Time Zone (EDT)
Now mind you, that's on my server, the server hosting your page might use a different set of internal variables, I don't know. In order for me to get the date to appear like this: 04/20/05, I have to use a: date +"%D"
And it turns out perfect. Anyway, in the .pl file, it also writes to the .HTML file with a - before date. I'll be perfectly honest, I don't see where the time comes in to play before the - in the .pl file, unless you changed something on me recently in the .pl file and didn't update the .txt file to reflect those changes. But here are the lines that affect where the time and date are written to the .html file:
if ($separator eq '1') {
print GUEST " - $date<hr>\n\n";
} else {
print GUEST " - $date<p>\n\n";
}You can see that it uses a - right off the bat before adding the $date to the file, what I don't get, is where the time is printed in that, but I'm guessing some changes where made in the .pl file, not shown in the .txt. I hope this helps a little, if this seems fairly confusing, I apologize, just ask and I will help to break it down.
•
•
Join Date: Mar 2005
Location: Everett, Wa (sub. north of Seattle)
Posts: 54
Reputation:
Rep Power: 4
Solved Threads: 0
The server I am running on is Unix based - here is some info from the serverinfo.cgi file...
[html]SERVER_SOFTWARE: Apache/1.3.33 (Unix) mod_fastcgi/2.4.2 FrontPage/5.0.2.2635 mod_jk/1.2.6
[/html]
As for the time and date shown... no I didn't change the .pl file, I copied the entries and the code from my old guestbook and added them to my new "guestbook.html" page so that I could retain my old entries and have then look like my new ones.
Ok, I have seen the - $date_command = "/usr/bin/date"; - and $date = `$date_command +"%A, %B %d, %Y at %T (%Z)"`; chop($date); near the top of the .pl file, but I don't know how to format it in the "# Open Link File to Output" section so that the date appears as desired. The time is desired, but not essential.
Thanks for your input so far, it has been invaluable!
[html]SERVER_SOFTWARE: Apache/1.3.33 (Unix) mod_fastcgi/2.4.2 FrontPage/5.0.2.2635 mod_jk/1.2.6
[/html]
As for the time and date shown... no I didn't change the .pl file, I copied the entries and the code from my old guestbook and added them to my new "guestbook.html" page so that I could retain my old entries and have then look like my new ones.
Ok, I have seen the - $date_command = "/usr/bin/date"; - and $date = `$date_command +"%A, %B %d, %Y at %T (%Z)"`; chop($date); near the top of the .pl file, but I don't know how to format it in the "# Open Link File to Output" section so that the date appears as desired. The time is desired, but not essential.
Thanks for your input so far, it has been invaluable!
•
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 107
Well, at the "# Open Link File to Output" section, where you see:
Try changing the - to a /, and if that doesn't work, I'll put on my sunglasses, and start digging into it in my infamous "Code Mode"
if ($separator eq '1') {
print GUEST " - $date<hr>\n\n";
}
else {
print GUEST " - $date<p>\n\n";
}Try changing the - to a /, and if that doesn't work, I'll put on my sunglasses, and start digging into it in my infamous "Code Mode"
•
•
Join Date: Mar 2005
Location: Everett, Wa (sub. north of Seattle)
Posts: 54
Reputation:
Rep Power: 4
Solved Threads: 0
•
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 107
So, It showed up the same as before, with the -, even when you changed it to a /????
Something just struck me like a ton of bricks about this too! The .pl file ONLY CHANGES THE .HTML FILE WHEN THERE IS A NEW ENTRY!!! That slipped my mind altogether. Basically, Only new entries would have the "changed" date, not the ones that are already there, because that time and date has already been written to the .HTML file in that format. So, only new entries would show up with the new date and time format. Also, the old entries would have to be changed by hand in order to look the same as the new entries!!!! I forgot completely that it re-writes the .HTML file, and only adds the new data! Sorry about that, I should have caught that one sooner!
Something just struck me like a ton of bricks about this too! The .pl file ONLY CHANGES THE .HTML FILE WHEN THERE IS A NEW ENTRY!!! That slipped my mind altogether. Basically, Only new entries would have the "changed" date, not the ones that are already there, because that time and date has already been written to the .HTML file in that format. So, only new entries would show up with the new date and time format. Also, the old entries would have to be changed by hand in order to look the same as the new entries!!!! I forgot completely that it re-writes the .HTML file, and only adds the new data! Sorry about that, I should have caught that one sooner!
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb HTML and CSS Marketplace
- Previous Thread: HREF Buttons have the blue border..yuk!
- Next Thread: Problems with Mp3 loading on site



Everything I replaced the - with just appeared verbatim in the GB entry like the dash did... ie: a/,
Linear Mode