Support => cpg1.3.x Support => Older/other versions => cpg1.3 Themes/Skins/Templates => Topic started by: donnoman on November 24, 2004, 08:59:11 am

Title: DOCTYPES, Validating, Empty Tags and &s.
Post by: donnoman on November 24, 2004, 08:59:11 am
DOCTYPES, Validating, Empty Tags and &s.

I wanted to share a little bit of what I've learned so far, as I haven't seen all of the info in one place.
Feel free to correct me, and add any information on the direction the Dev Team is taking and give guidance to
those of us working on themes, hacks and mods.

The classic template.html lists  HTML 4.01 Transitional as its DOCTYPE.

Code: [Select]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

The classic template.html from the current source tree of 1.4 is XHTML 1.0 Transitional.

Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

Which is consistent with the discussions I've seen stating the goal of XHTML 1.0 Transitional for CPG 1.4.

I am assuming that since 1.32's DOCTYPE is listed as 4.01 Transitional that the rest of the code was built with that DOCTYPE in mind.

The problem is that the new EMPTY TAG notation confuses the validators for HTML 4.01 Transitional.

As can be expected the pages don't validate as XHTML either, since there are many Empty Tags are missing the new notation.

I don't expect this to be fixed in 1.32 since it's a lot of work and 1.32 is done.  Just wanted to point out to other theme developers that
it's probably unrealistic to try and write a XHTML 1.0 Trans Theme and have it validate using 1.32 code. And right now unless you wanted to go through
and replace all the " /> tag notation its not realistic to write a 4.01 Transitional theme that validates with the 1.32 code either.

Does it matter, probably not, browsers seem to be rendering the 1.32 code just fine.

One thing I wan't to warn other folks about is that the empty tag notation such as <hr /> that
is becoming more popular as XHTML takes hold is that it is NOT meant to replace normal end tags on
every HTML statement. So don't do a search and replace of ">" with " />" on your pages.

This is the best document I've found that explained what the notation is actually used for (One of my AHA! moments).

Basically if normal html tags enclose data they are not an EMPTY tag.


<p> DATA </p>  
<h1> Heading </h1>

Are not empty tags. There's a <begining> content and </ending>



Are EMPTY tags because they don't surround any data.

<IMG src="blank.gif">

Is ALSO an EMPTY Tag because it doesn't surround any data. (it did sneak some in, but INSIDE the tag itself)

Only EMPTY TAGS woulde be written as:


<img src="blank.gif"/>

However this notation has confused a lot of browsers so the W3c came out with a recomendation to use whitespace before the end tag
which results in:

<hr />
<br />
<img src="blank.gif" />

Which in turn, causes your pages to not Validate as proper HTML 4.01 Transitional nor 4.01 Strict.
XHTML 1.0 Transitional should work. A lot of other validaton issues with 1.32 code, I expect most of those getting worked out by the dev team for 1.4. (Thanks Guys)
This notation won't validate as XHTML 1.0 Strict. (Not particularly a goal for Coppermine at this point).

Which brings me to my last point $amp;s.

Technicanlly speaking when you encode a url in html &'s should be replaced by &amp's.

There's a ton of 'em inside the 1.32 code and throughout the themes.

so something like <a href src="index.asp?cat=0&theme=classic">Link</a> should be re-written as:
<a href src="index.asp?cat=0&amp;theme=classic">Link</a>

You will have XHTML 1.0 Transitional Validation problems with the former notation claiming "entities aren't defined".

Title: Re: DOCTYPES, Validating, Empty Tags and &amp;s.
Post by: vuud on December 09, 2004, 09:34:39 pm

You mentioned making a transitional theme and how it would not be possible.  While I don't think it can be done 100% without minor alterations to the main code, I have been able to get darned close by just editing the templates and theme php file.  At this point I am down to about 100 violations out of starting with 400.  The majority of these are a set of 4 errors that occur for each album and it is due to some funky character code in the album img code.  The code itself looks valid, except for the ending />.  But there seems to be something strange between the class="image" and the border="0". 

<img src="albums/2004_12_06/thumb_bo_img_1132.jpg" class="image"  height="100" border="0" alt="bo_img_1132.jpg">

The w3c validator has gotten confused right in there thinking the tag ended.  Even if I go into view the source through firefox, I have trouble moving the cursor over that spot.

Iine 319, column 135: an attribute specification must start with a name or name token
Line 319, column 136: end tag for "img" omitted, but OMITTAG NO was specified
Line 319, column 73: start tag was here

I have not been able to locate in the main code where it is generating this tag... it gets sent into the theme as part of an array.

Otherwise, I hope to reach it at some point - or as much as I can without changing the code.  (that I will submit for the next release)


Vuud - then click on the XHTML button to see what is not working

Title: Re: DOCTYPES, Validating, Empty Tags and &amp;s.
Post by: chtito on December 09, 2004, 10:12:13 pm
If you are using version 1.3.2 there is no chance to validate any theme in XHTML transitional. However it is almost possible to validate even XHTML strict with the forthcoming version 1.4. It should be just a few months away ;)
Title: Re: DOCTYPES, Validating, Empty Tags and &amp;s.
Post by: vuud on December 09, 2004, 10:23:13 pm

Thanks!  I noticed after posting a few mentions about 1.4 being much better with XHTML.  I was tinkering with the idea of moving to it now (I tend to run a lot of bleeding edge stuff), but don't want to risk all the data :)

Thanks for the post though
Title: Re: DOCTYPES, Validating, Empty Tags and &amp;s.
Post by: Casper on December 09, 2004, 10:34:42 pm
In 1.4, the core code ia already fully xhtml transitional, except in 1 instance (the fullsize pop-up.)

So it is then down to the themes.  So far, 5 of the bundled themes are also done, plus at least 3 non-bundled ones.
Title: Re: DOCTYPES, Validating, Empty Tags and &amp;s.
Post by: vuud on December 09, 2004, 10:51:14 pm

Really?  The fullsize popup has to be the simplest page in the whole thing :)

Well - it is sounding good.  Can't wait
Title: Re: DOCTYPES, Validating, Empty Tags and &amp;s.
Post by: Joachim Müller on December 10, 2004, 01:19:26 am
I'd say it's pretty safe to use cpg1.4 in terms of risk of data loss. Some features just might turn out not to work as expected (error messages). If you understand that cpg1.4 currently goes unsupported while in beta state, I suggest you give it a try.

Title: Re: DOCTYPES, Validating, Empty Tags and &amp;s.
Post by: vuud on December 10, 2004, 02:56:07 am

I run stuff like mythtv and quanta+ and such out of cvs...  But I just recently had my whole coppermine install wiped (600+ photos), and just got about half of those back in.  So I just want to be done with it and all.  I also just got the theme fitting into the rest of my web site nicely and need a break.