Validating HTML/PHP
Hello,
I hope its ok to ask here, my site is the first and only one i have ever done.
It has been incredibly popular, and is visited every day.
Its all been one huge learning curve, and I still have to experiment with everything
to understand what works and what doesn't..
In early day I thought it would be nice to link into a hit counting idea, just so i could see
if the site was actually being used.
The count went crazy after 10000 hits and I have had to remove the link.
My son has written a couple of very elegant php functions that enable me to create my own,
which is something I like to do... a bit anal i guess but good fun!
I have inserted the php at the top of the page, the w3c validation fails and I wondered if there was a certain Doc type I should be using.
The integration of php is a neat thing and it would be nice to be able to use it. But there is a lot of basic understanding that i still have to grasp.......
Thankyou for any help or pointers you may be able to give
Regards
Peter
I hope its ok to ask here, my site is the first and only one i have ever done.
It has been incredibly popular, and is visited every day.
Its all been one huge learning curve, and I still have to experiment with everything
to understand what works and what doesn't..
In early day I thought it would be nice to link into a hit counting idea, just so i could see
if the site was actually being used.
The count went crazy after 10000 hits and I have had to remove the link.
My son has written a couple of very elegant php functions that enable me to create my own,
which is something I like to do... a bit anal i guess but good fun!
I have inserted the php at the top of the page, the w3c validation fails and I wondered if there was a certain Doc type I should be using.
The integration of php is a neat thing and it would be nice to be able to use it. But there is a lot of basic understanding that i still have to grasp.......
Thankyou for any help or pointers you may be able to give
Regards
Peter
The site in your sig validates. We would need a url if that is not the site. The W3C validation service tells you exactly what the error is.
CoffeeCup... Yeah, they are the best!
Thankyou,
Here is the link............ http://www.manxmaniac.co.uk/index.php
The counter is on the top left, I must first understand why the validation fails,
then how to 'move' the count somewhere else on the page.
It all seems very different to how the html works...
Thanks for your help
Peter
Here is the link............ http://www.manxmaniac.co.uk/index.php
The counter is on the top left, I must first understand why the validation fails,
then how to 'move' the count somewhere else on the page.
It all seems very different to how the html works...
Thanks for your help
Peter
First things first.
You have no doc type. You need one. Put this at the top of the file and remove the existing html tag.
Next. Take the line after that that is the img tag and place it somewhere inside the html area.
And go through all the code and replace
with
Then, see what the validation does.
You have no doc type. You need one. Put this at the top of the file and remove the existing html tag.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html xmlns="http://www.w3.org/1999/xhtml">
Next. Take the line after that that is the img tag and place it somewhere inside the html area.
And go through all the code and replace
src=hitcounterImages/...
with
src="hitcounterImages/..."
Then, see what the validation does.
CoffeeCup... Yeah, they are the best!
Thanks Tom,
That threw me completely.... As I do have a doc type in the file and the img statements you mention are not written that way in the index file, just the call to the counter function...
However I 'viewed page source' when looking at my site on the internet and can see what you are talking about.
The doc type is above the image statements....., does the php file get read, and the code contents substituted??
Moving the image statements just seems to display the individual images and they are not hooked into the counter anymore. They are the direct addresses of the image stored on the server, and wont change.
The hit code function should/just read the relevant image in the image directory on the server and display it as it builds the count on the screen.
Here is the initial, original html....
view-source:http://www.manxmaniac.co.uk/index.php
It should look like this....
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
include 'functions.php';
hit_counter();
?>
<head>
Regards
Peter
That threw me completely.... As I do have a doc type in the file and the img statements you mention are not written that way in the index file, just the call to the counter function...
However I 'viewed page source' when looking at my site on the internet and can see what you are talking about.
The doc type is above the image statements....., does the php file get read, and the code contents substituted??
Moving the image statements just seems to display the individual images and they are not hooked into the counter anymore. They are the direct addresses of the image stored on the server, and wont change.
The hit code function should/just read the relevant image in the image directory on the server and display it as it builds the count on the screen.
Here is the initial, original html....
view-source:http://www.manxmaniac.co.uk/index.php
It should look like this....
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
include 'functions.php';
hit_counter();
?>
<head>
Regards
Peter
Hello,
I have looked at the php functions, and am not sure but applied a bit of my knowledge of 'C'.....
I have put the call into an iframe, and modified the php file that declares the functions.
It all seems to work now and even validates....
http://www.manxmaniac.co.uk/index.php
WooHoo
Thankyou for your help
Regards
Peter
I have looked at the php functions, and am not sure but applied a bit of my knowledge of 'C'.....
I have put the call into an iframe, and modified the php file that declares the functions.
It all seems to work now and even validates....
http://www.manxmaniac.co.uk/index.php
WooHoo
Thankyou for your help
Regards
Peter
Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.