User Name Password Register
DaniWeb IT Discussion Community
All
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
Reply
Join Date: Mar 2005
Location: Everett, Wa (sub. north of Seattle)
Posts: 54
Reputation: redsabre is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
redsabre's Avatar
redsabre redsabre is offline Offline
Junior Poster in Training

editing the appearance of entries in a guestbook

  #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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 107
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: editing the appearance of entries in a guestbook

  #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:

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.
Reply With Quote  
Join Date: Mar 2005
Location: Everett, Wa (sub. north of Seattle)
Posts: 54
Reputation: redsabre is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
redsabre's Avatar
redsabre redsabre is offline Offline
Junior Poster in Training

Re: editing the appearance of entries in a guestbook

  #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  
Join Date: Mar 2005
Location: Everett, Wa (sub. north of Seattle)
Posts: 54
Reputation: redsabre is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
redsabre's Avatar
redsabre redsabre is offline Offline
Junior Poster in Training

Re: editing the appearance of entries in a guestbook

  #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  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 107
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: editing the appearance of entries in a guestbook

  #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:

$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.
Reply With Quote  
Join Date: Mar 2005
Location: Everett, Wa (sub. north of Seattle)
Posts: 54
Reputation: redsabre is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
redsabre's Avatar
redsabre redsabre is offline Offline
Junior Poster in Training

Re: editing the appearance of entries in a guestbook

  #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  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 107
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: editing the appearance of entries in a guestbook

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

 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"
Reply With Quote  
Join Date: Mar 2005
Location: Everett, Wa (sub. north of Seattle)
Posts: 54
Reputation: redsabre is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
redsabre's Avatar
redsabre redsabre is offline Offline
Junior Poster in Training

Re: editing the appearance of entries in a guestbook

  #8  
Apr 21st, 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  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 107
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: editing the appearance of entries in a guestbook

  #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  
Join Date: Mar 2005
Location: Everett, Wa (sub. north of Seattle)
Posts: 54
Reputation: redsabre is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
redsabre's Avatar
redsabre redsabre is offline Offline
Junior Poster in Training

Re: editing the appearance of entries in a guestbook

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb HTML and CSS Marketplace
Thread Tools Display Modes

Other Threads in the HTML and CSS Forum

All times are GMT -4. The time now is 4:28 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC