Click to See Complete Forum and Search --> : HTML Validation - Help -
momossy
04-14-2010, 03:40 PM
Hi guys,
Im having an issue validating a page that uses php and html. if you look at the sample below you can get an idea of what i'm talking about.
simple answer i'm looking for is, why is this failing the validation? is it an easy fix?
<ul id="slideshow">
<?php $page =..... etc
<li>
<h3><a href="<?php the_permalink();?>" title= get title
<span><?php $values = get image
<p><span class="date">Completed <?php the_date...
<a href="<?php the_permalink();?>"><img src= get thumb...
</li>
<?php endwhile;?>
</ul>
---- validating errors (w3c)----
# Error Line 95, Column 8: Opening and ending tag mismatch: a line 90 and li
</li>
✉
# Error Line 118, Column 8: Opening and ending tag mismatch: a line 113 and li
</li>
✉
# Error Line 141, Column 8: Opening and ending tag mismatch: a line 136 and li
</li>
✉
# Error Line 164, Column 8: Opening and ending tag mismatch: a line 159 and li
</li>
✉
# Error Line 168, Column 19: Opening and ending tag mismatch: li line 144 and ul
</ul>
tracknut
04-14-2010, 07:23 PM
Can you give us a link to the actual page, so we can see ALL the html, not just selected snippets?
Dave
tirna
04-14-2010, 07:38 PM
or for those like me who are paranoid about clicking posted links :eek:, maybe right-click your web page on the server, select view source, save it to a text file and then post the entire text file here.
momossy
04-15-2010, 02:48 AM
Sorry guys,
txt file.
tirna
04-15-2010, 03:38 AM
1) I assume you are using the w3c validator.
2) You didn't follow the instructions in my request earlier.
What you have attached is the php file with html in it and not the html that is returned to the requesting browser after it has been processed by the php 'engine' on the server.
The w3c validator validates the html returned after the php file is processed by the php engine and it is that html you would need to look at to work out why it is failing the validator.
It is possible that some of the php code is generating the invalid html. Once the offending html is identified, then if it is generated by php code, you would then go and fix the php code and go through the process of validating and checking again until the returned html passes the validator.
I assume you weren't inputing the unprocesed php file into the validator. :eek:
momossy
04-15-2010, 04:24 AM
Yes w3c validator.
and yes I am talkingin about HTML validation I am aware PHP is processed firstly.
I thaought I did follow your request? I saved it as a txt file.
The reason I am getting so many errors is because php is duplicating the code for each entry in the database, thus duplicating the error with the html.
This is the
<ul>
<li>
<h3><a href="http://www.di.co.uk" title="Permanent Link to">Website imminent</a></h3>
<span>http://di.co.uk/w/themes/w/images/bg-3.jpg</span>
<p><span class="date">Completed 11. April 2010 at 1:00 pm</span><br/><br/>
Hello Guys,
</p>
<a href="http://www..co.uk"><img src="http://di.co.uk/wpcontent/themes/w/scripts/timthumb.php?src=http://di.co.uk/wp-content/themes/w/images/bg-3.jpg" alt="" />
</li>
<ul>
"I assume you weren't inputing the unprocesed php file into the validator." is there a way of doing this? and still have a direct link to w3c validator?
tirna
04-15-2010, 04:29 AM
.....I thaought I did follow your request? I saved it as a txt file......
Yes you did save it as a text file but you didn't follow the earlier steps because if you did, you would have only got html in the txt file and not a mixture of php code and html code.
momossy
04-15-2010, 05:08 AM
I Have uploaded the copy from the w3c output with the faults. sorry Tirna bit confusing.
tracknut
04-15-2010, 08:47 AM
You are missing </a> tags just before each </li>
Dave
momossy
04-15-2010, 12:53 PM
Tracknut thank you very much, big help, can't thank you enough. majority of them are now gone. I had 6 errors remaining but managed to figure out another one, "ul i=" should have been a div, doh.
# Info Line 35, Column 3: start tag was here
<div id="wrapper">
# Error Line 300, Column 7: Opening and ending tag mismatch: div line 35 and body
</body>
✉
# Error Line 301, Column 7: Opening and ending tag mismatch: body line 33 and html
</html>
✉
# Error Line 301, Column 7: Premature end of data in tag html line 2
</html>
does this mean I haven't closed something off?
again thanks..
tracknut
04-15-2010, 01:33 PM
Definitely, it looks like you're missing a closing </div> somewhere, it's probably causing all of those errors.
Dave
momossy
04-15-2010, 01:38 PM
I just added a closing div tag at the bottom and hay presto, haha. Not sure what its off but everything seems to be working. you made my day. thanks
tracknut
04-15-2010, 01:47 PM
No problem!