Changing the appearance of Guestbook.

Dr. GBooky is here to help you with your guestbook problems ...
Villanesca
Posts: 8
Joined: Mon Dec 06, 2010 4:53 pm

Changing the appearance of Guestbook.

Post by Villanesca »

Script URL:
Version of script: 1.7
Hosting company: blackfoot
URL of phpinfo.php: I do not have such a file?
URL of session_test.php: http://www.sins.org.uk/Guestbook/session_test.php
What terms did you try when SEARCHING for a solution: appearance, content, change,amend, and combinations of these.

Write your message below:

My Guestbook works well doing what it is designed to do - thank you PHP Junkyard.
I would like to alter the background colour scheme and replace the "Guestbook" logo image. However, I am struggling to do this.

I have replaced the bg.png and the book.png files in the Guestbook/Templates/default/Images directory with my own files and altered the coding to the new file names in the style sheet. I have tried image extensions with jpg, gif and png yet none appear. The original "Guestbook" and background images both disappear but the new ones fail to pop up and replace them.

How do I change the appearance of my Guestbook's background and insert my own logo picture?
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Changing the appearance of Guestbook.

Post by Henrie »

Hello Villanesca,

After changing the style. Refresh the page by using Ctrl + F5

And just to make sure (you described you used this way but i want to make sure anyway).
You should edit the style.css file in the /templates/default/ directory

For the background image find this line

Code: Select all

body{margin:0; padding:0; background-image:url(images/bg.png); background-repeat:repeat-x; font-family:Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; color:#003399;}
and change the images/bg.png to point to your background image (best place is to put it also in the images directory.

For the guestbook logo find this line

Code: Select all

#gbook_header{width:600px; height:150px; margin:0 auto; background-image:url(images/book.png); background-repeat:no-repeat;}
and change the images/book.png to point to your own logo.

Furthermore i noticed that you also seem to have a codepage error (which can be seen when you open the guestbook in Firefox, there are characters  shown at the start of the page). Try changing inside your language file (language.inc.php) $lang['enc']='windows-1250'; to $lang['enc']='windows-1252'; like the rest of your pages. Or if that does not solve it, change it to $lang['enc']='utf-8';

Greetings,
Henrie
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
Villanesca
Posts: 8
Joined: Mon Dec 06, 2010 4:53 pm

Re: Changing the appearance of Guestbook.

Post by Villanesca »

Many thanks Henrie, all is now sorted.
Excellent result, much appreciated. :D
Villanesca
Posts: 8
Joined: Mon Dec 06, 2010 4:53 pm

Re: Changing the appearance of Guestbook.

Post by Villanesca »

Woops!

No it is not working OK.
It works fine in Chrome and Mozilla browsers but the centred heading appears over on the left within Internet Explorer.

Is there a coding I can add to the style sheet that will fix this?
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Changing the appearance of Guestbook.

Post by Henrie »

I can reproduce the problem, but it does not seem to be an error in the style.

Did you try to edit the gbook.php file? And did you save it afterwards?
I have a hunch that it is saved in UTF-8 format instead of the default file format and that Internet Explorer does not like the BOM (Byte Order Mark) at the start of the file.
Can you please upload the original gbook.php file from the zip-file you downloaded from phpjunkyard.com to your webserver?

Greetings,
Henrie
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
Villanesca
Posts: 8
Joined: Mon Dec 06, 2010 4:53 pm

Re: Changing the appearance of Guestbook.

Post by Villanesca »

Hi Henrie,
I did not try to make any amendments to the gbook file, However, to play safe, I have replaced the server version with the unzipped version. It has not corrected the problem. I have also re-instated the original picture file just in case my picture was causing the problem. That too has not cured the problem.

Might it be anything to do with altering the language.inc.php file for the Slang problem earlier?
utf-8 was the code that finally worked.

It is quite perplexing that it only malfunctions in Internet Explorer.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Changing the appearance of Guestbook.

Post by Klemen »

Henrie is right, it's probably the BOM that's causing the problem. You probably don't see it in your editor, but it's there because you didn't just set encoding to utf-8, you saved the file as an utf-8 encoded file.

Try installing Notepad++
http://notepad-plus-plus.org/release/5.8.5

Then open the header file in Notepad++ and see if you have some strange characters at the beginning of the very first line. Delete those, save as plain text, upload again and give it a try.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Villanesca
Posts: 8
Joined: Mon Dec 06, 2010 4:53 pm

Re: Changing the appearance of Guestbook.

Post by Villanesca »

You chaps are brilliant. I wish I had half of your talents and coding abilities !

All is sorted. Many, many thanks. :D
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Changing the appearance of Guestbook.

Post by Henrie »

Could you tell us how the page ended up being saved in UTF-8 format? Because you told us you did not open and save it. It makes me curious how it ended up as UTF-8 on your file server.

Henrie
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
Villanesca
Posts: 8
Joined: Mon Dec 06, 2010 4:53 pm

Re: Changing the appearance of Guestbook.

Post by Villanesca »

Ok here goes.

From Klemen's posting I was not sure what he meant by the "header" file. I had a file named header.txt which I thought was the one. However when I opened up this file it was completely devoid of any text in any form. So that could not have been the file he meant (?).

I then found the file "overall_header" so opened that up in Microsoft Expression (I know, I 'm sad and know no better). There were no spurious characters in the top line. However I remembered I had previously looked into this file to see if there was any personalisation facility. I could not remember whether previously I had closed the said file by saving or quitting, so I re-opened it in Notebook and saved it. Bingo! that cured the problem.

Am I right in thinking that the file in question therefore never was saved in utf-8 format but in the format that Expression probably saves it in?

Does that explain or confuse?

How much is a beer in the USA?
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Changing the appearance of Guestbook.

Post by Klemen »

Yes, it's the overall_header that was problematic. Sorry, should have made that clearer. It was probably MS Exchange that saved it in utf-8 format, not sure though.

Neither of us are from the US (both from Europe). Henrie found the problem so feel free to buy him a big Dutch soda (he doesn't drink beer ;-) )

P.s.: I personally have nothing against Microsoft products (both Windows and IE on my machine :wink: ), feel free to use anything that works for you!
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Changing the appearance of Guestbook.

Post by Henrie »

I found the problem, but I did not fix it. So no need to buy me anything.

I just checked and the problem is not solved yet.
When I open the guestbook in Firefox I can still see  at the start of the page and also before the text Administrator at Name:. Also some special characters in the first post are converted. I think the entry was written when the page was UTF-8 encoded. And now is displayed wrong.

The header.txt and footer.txt files are saved in ISO-8859-1 (according to Firefox) so they should be okay.
Maybe it is possible for you to zip your guestbook files and subfolders as you have them now and make them available for me for download. I would like to have a look to what is causing the problems.
Because as far as i can now see, the BOM is still present in the gbook.php file. But because the file is parsed by php before it is presented on the internet I can not be sure about this.

Greetings,
Henrie
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
Villanesca
Posts: 8
Joined: Mon Dec 06, 2010 4:53 pm

Re: Changing the appearance of Guestbook.

Post by Villanesca »

Hello Henrie,
Many thanks for persevering with this.
Go to [link removed by moderator Henrie] to collect the zip file.
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Re: Changing the appearance of Guestbook.

Post by Henrie »

Hello Villanesca,

It is as I thought, some files were saved in UTF-8 format.
The bad files are: settings.php and your renamed entries.txt file.

To solve it, please download and install Notepad++ as Klemen suggested
http://notepad-plus-plus.org/release/5.8.5

Than open the file settings.php and Notepad++ and in the menu choose "Encoding". If I am right, the option "Encode in UTF-8" will be checked. You should choose the option "Convert to ANSI". In the bottom information line of the Notepad++ window the text UTF-8 will change to ANSI. Than save and close the file.
Now the  text at the top of the page when viewed in Firefox will be gone.

For the renamed entries.txt file you should do the same.
This will take care of the  and wrongly displayed special characters in the already posted message.

If you do not manage to do this by yourself, send me a pm with your e-mail address and I will send the changed files to you.

Greetings,
Henrie

PS. And thank you very much for your donation. I really appreciate it.
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
Villanesca
Posts: 8
Joined: Mon Dec 06, 2010 4:53 pm

Re: Changing the appearance of Guestbook.

Post by Villanesca »

Many thanks Henrie, all has now been satisfactorily corrected.

Previously I simply used the version of Notepad that came loaded with my computer. This version does not give any of the options the newly downloaded Notepad program provides.

All very much a question of "When all else fails, read the instructions" ! :)
Post Reply