XHTML 1.0 Validity

Found a bug? Tell us!!
Post Reply
jedidjab79
Posts: 4
Joined: Thu Nov 06, 2003 9:23 am

XHTML 1.0 Validity

Post by jedidjab79 »

Heya

Just downloaded the software yesterday and had it running in no time -- it's great! Exactly what I was looking for :)

I was especially interested in the strict XHTML 1.0 option in the administration options. After enabling it, I tried out the W3C validator and ran into a few errors. I've fixed them on my site, and it appears to be perfectly valid now.

Here's what I changed, please let me know if they're decent fixes and could be incorporated into the code stream...

serendipity_genpage.inc.php

(add this at the very top -- otherwise they don't think we're xhtml)

Code: Select all

<?php if ($serendipity['XHTML11']) { ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php } else { ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
           "http://www.w3.org/TR/html4/loose.dtd">
<?php } ?>
(add a trailing / so it's valid xhtml)

Code: Select all

<meta name="Powered-By" content="Serendipity v.<?php echo $serendipity['version'] ?>"/>
serendipity_functions.inc.php

(line 347 -- it was never printing the opening <tr> for each calendar week after the first one )

Code: Select all

// After the first row, we need to have the <tr> opener
if ($x >= 1)
echo '<tr class="serendipity_calendar">'
(line 311 -- nobr isn't supported in xhtml and this seems to work just as well)

Code: Select all

<b><span style="white-space:nowrap"><a href="<?php echo $link; ?>"><?php echo $serendipity["months"][$month] . ' \'' . substr($year, 2); ?></a></span></b>
(line 720 & 726 -- xhtml is fussy about capitalisation)
'onclick' instead of 'onClick'


Once again, great product and I'd really like to do anything I can to help make it better :)

Cheers
casper
Last edited by jedidjab79 on Tue Nov 11, 2003 8:17 am, edited 2 times in total.
jedidjab79
Posts: 4
Joined: Thu Nov 06, 2003 9:23 am

Post by jedidjab79 »

Oops! I spoke to soon. Tried adding a URL to one of my posts and got 6 new errors. Here are a few more updates:

serendipity_functions.inc.php
(line 1339 -- all attributes have to be lowercase)

Code: Select all

'<a%shref="%sexit.php?url=%s%s" title="%s" onmouseover="window.status=\'%s\';return true;" onmouseout="window.status=\'\';return true;"',
Also (and I'm not using the WYSIWIG editor), if you enter a URL in your blog entry, say

Code: Select all

<A HREF="http://www.cnn.com">CNN</A>
it appears that serendipity takes it and translates it to

Code: Select all

<a href= ....some db stuff here... >CNN</A>
Now, granted, this is a minor point, but if people are using the editor, it would be good to note on the 'edit page' that the user should make sure all tags are lower case. Just want to make sure it's as easy as possible for people to generate valid xhtml :)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Thanks a lot for your work to get to the insides of s9y. Your patches where very helpful to improve the XHTML validity of s9y, and I have just implemented them into CVS.

Best regards,
Garvin.
Guest

Post by Guest »

In 'Admin Interface>Configuration>Appearance and options' it says 'Force XHTML 1.1 compliance'

Maybe can change the menu to 1.0 or the genpage to

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
The W3 validator says that

Code: Select all

<img alt="Back" src="/templates/default/img/back.png" border="0" />
<img alt="FORWARD" src="/templates/default/img/forward.png" border="0" />
isn't ok, the code is in serendipity_funtions.inc.php

Code: Select all

<a title="<?php echo BACK; ?>" href="<?php echo $serendipity['serendipityHTTPPath'] . $serendipity['indexFile']; ?>?serendipity[calendarZoom]=<?php echo $previousYear . sprintf('%02d',$previousMonth) . $add_query; ?>"><img alt="<?php echo BACK; ?>" src="<?php echo serendipity_getTemplateFile('img/back.png'); ?>" border="0" /></a>

<a title="<?php echo FORWARD; ?>" href="<?php echo $serendipity['serendipityHTTPPath'] . $serendipity['indexFile']; ?>?serendipity[calendarZoom]=<?php echo $nextYear . sprintf('%02d', $nextMonth) . $add_query; ?>"><img alt="<?php echo FORWARD; ?>" src="<?php echo serendipity_getTemplateFile('img/forward.png'); ?>" border="0" /></a>
Maybe can solve it deleting border="0" and using instead a <div> with CSS.

I wish that Serendipity was 100% valid XHTML and CSS. ;)

PD: Sorry for my poor english.
rpos
Posts: 4
Joined: Sun Mar 28, 2004 9:29 pm

Post by rpos »

I tried to validate, but it failed. After changing the file:
/serendipity/serendipity_genpage.inc.php with this XHTML line:

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">

it works.

The difference is: the line is written over 3 lines and the trailing /> is replaced with > directly after dtd" without a space.

Correct me if i'm wrong, but my code validates now.
BerndH
Posts: 1
Joined: Thu Sep 30, 2004 12:04 am
Location: Germany
Contact:

DTD Missing & Render Errors

Post by BerndH »

Hello,

i just kicked Wordpress off my webspace for your lovely peace of software!

Atm i'm introducing myself to XHTML+CSS, and i already had some negative experiences with browser hacks n layout issues...damn...

I just installed Serendipity 0.7-beta3 and checked for the DTD. The ugly thing if found, is that this version points to a non existing dtd on w3c webspace.

Code: Select all

http://www.w3.org/TR/xhtml1/xhtml1-transitional.dtd
in the above mentioned serendipity_genpage.inc.php

Betta one:

Code: Select all

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd

Full List of DTD available @ http://www.w3.org/QA/2002/04/valid-dtd-list.html


A missing DTD causes the browser to use some ugly compatibility mode, which causes non standard and not-intended rendering of the page.

A very good overview can be found over at http://css.maxdesign.com.au/listamatic/ ... xmodel.htm. Be sure to Bookmark this one!

Keep it up guys!

--------------------------------------------------------
Visit my Blog @ http://berndharrer.de/blog/
Visit my Website @ http://berndharrer.de/
jhermanns
Site Admin
Posts: 378
Joined: Tue Apr 01, 2003 11:28 pm
Location: Berlin, Germany
Contact:

Post by jhermanns »

thanks bernd, i just fixed it in cvs!
Post Reply