editing the appearance of entries in a guestbook

Reply

Join Date: Mar 2005
Posts: 55
Reputation: redsabre is an unknown quantity at this point 
Solved Threads: 0
redsabre's Avatar
redsabre redsabre is offline Offline
Junior Poster in Training

editing the appearance of entries in a guestbook

 
0
  #1
Apr 19th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 212
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: editing the appearance of entries in a guestbook

 
0
  #2
Apr 20th, 2005
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:

HTML and CSS Syntax (Toggle Plain Text)
  1. 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)
  1. 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.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 55
Reputation: redsabre is an unknown quantity at this point 
Solved Threads: 0
redsabre's Avatar
redsabre redsabre is offline Offline
Junior Poster in Training

Re: editing the appearance of entries in a guestbook

 
0
  #3
Apr 20th, 2005
Ok, thanks... just don't know the lingo yet I guess. I'll be working on it and let you know when I have it done so you can see... (If'n ya want)

Thanks again Coma!

RS
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 55
Reputation: redsabre is an unknown quantity at this point 
Solved Threads: 0
redsabre's Avatar
redsabre redsabre is offline Offline
Junior Poster in Training

Re: editing the appearance of entries in a guestbook

 
0
  #4
Apr 20th, 2005
P.S. can you tell from lookin at the .pl file why my date/time appears as "-" insted of showing the date/time? In my old GB it appeared as... 12:22 am - Monday, April 11, 2005
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 212
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: editing the appearance of entries in a guestbook

 
0
  #5
Apr 20th, 2005
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:

HTML and CSS Syntax (Toggle Plain Text)
  1. $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)
  1. # Get the Date for Entry
  2. $date = `$date_command +"%A, %B %d, %Y at %T (%Z)"`; chop($date);
  3. $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)
  1. %A Represents The Day Of The Week (Monday, Tuesday, Wednesday, etc)
  2. %B Represents The Month (april, may, june)
  3. %d Represents The Day Of The Month (19, 20)
  4. %Y Represents The Year (2005)
  5. %T Represents The Time (18:08:21)
  6. %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)
  1. if ($separator eq '1') {
  2. print GUEST " - $date<hr>\n\n";
  3. } else {
  4. print GUEST " - $date<p>\n\n";
  5. }

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.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 55
Reputation: redsabre is an unknown quantity at this point 
Solved Threads: 0
redsabre's Avatar
redsabre redsabre is offline Offline
Junior Poster in Training

Re: editing the appearance of entries in a guestbook

 
0
  #6
Apr 21st, 2005
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!
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 212
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: editing the appearance of entries in a guestbook

 
0
  #7
Apr 21st, 2005
Well, at the "# Open Link File to Output" section, where you see:

HTML and CSS Syntax (Toggle Plain Text)
  1. if ($separator eq '1') {
  2. print GUEST " - $date<hr>\n\n";
  3. }
  4. else {
  5. print GUEST " - $date<p>\n\n";
  6. }

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"
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 55
Reputation: redsabre is an unknown quantity at this point 
Solved Threads: 0
redsabre's Avatar
redsabre redsabre is offline Offline
Junior Poster in Training

Re: editing the appearance of entries in a guestbook

 
0
  #8
Apr 22nd, 2005
Ok Coma, get out your sunglasses

I tried exactly what you said, and also tried a few of my own creative ideas... none workded Everything I replaced the - with just appeared verbatim in the GB entry like the dash did... ie: a/,

Thanks for your persistence.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 212
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: editing the appearance of entries in a guestbook

 
0
  #9
Apr 22nd, 2005
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!
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 55
Reputation: redsabre is an unknown quantity at this point 
Solved Threads: 0
redsabre's Avatar
redsabre redsabre is offline Offline
Junior Poster in Training

Re: editing the appearance of entries in a guestbook

 
0
  #10
Apr 22nd, 2005
no, not with the "-"... with whatever I replaced the "-" with, like the "a/"

When I do change the - to a/, it just prints (or diplays) "a/" insted of the "-"

Yes, that's right. I changed the HTML manually in the old entries, sorry I didn't mean for you to lose your mind.


so, am I out of luck here?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the HTML and CSS Forum


Views: 12892 | Replies: 11
Thread Tools Search this Thread



Tag cloud for HTML and CSS
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC