| | |
editing the appearance of entries in a guestbook
![]() |
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
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:
HTML and CSS Syntax (Toggle Plain Text)
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:
HTML and CSS Syntax (Toggle Plain Text)
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.
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.
HTML and CSS Syntax (Toggle Plain Text)
$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:
HTML and CSS Syntax (Toggle Plain Text)
# 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):
HTML and CSS Syntax (Toggle Plain Text)
%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:
HTML and CSS Syntax (Toggle Plain Text)
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.
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!
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"
HTML and CSS Syntax (Toggle Plain Text)
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"
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!
![]() |
Other Threads in the HTML and CSS Forum
- Previous Thread: HREF Buttons have the blue border..yuk!
- Next Thread: Problems with Mp3 loading on site
Views: 12892 | Replies: 11
| Thread Tools | Search this Thread |
Tag cloud for HTML and CSS
2002 alignment asp background backgroundcolor blog browser cascade center code compatibility containers corporateidentity create css deleted design designing distortion div divs dreamweaver emailmarketing embed explorer fail firefox float font fonts format free frontpage google helprequired-urgent hitcounter hover html ide ie6 ie7 iframe image input internet internetexplorer intranet iphone javascript jpeg js links list macbook maps margin marketshare missing mozilla mp3 navigationbars newb object offshoreoutsourcingcompany opacity override overwrite perl pnginie6 position positioning problem relative scroll seo studio style table tables tag templates text textcolor timecolor url urlseparatedwords validation visual visualization web webform website websitedesign windows7 word wordpress xhtml xml xsl youtube







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