Latest plans for new themes and templates

Re: Latest plans for new themes and templates

by Barry McMullin -
Number of replies: 15

Looks excellent Martin - this is going to be a really exciting and positive development in Moodle.

Can I suggest some discussion at this pivotal stage about whether XHTML transitional is the right thing to aim for? The alternative is, of course, XHTML strict. I'm not sure why you are suggesting the former: so this might be a small issue, or quite a big one - but I'd certainly welcome discussion.

We may want to make a distinction here between what is used "internally" in the Moodle templates, and what actually gets delivered to the client side. Indeed, there are conflicting opinions on whether it is a good idea yet to deliver XHTML (of any dialect) to the client side.

But either way I would want to argue that the "real" revolutionary step is not that between HTML and XHTML, but that between "transitional" and "strict". This is because it is precisely here that we are challenged to go for the full-blooded separation of content (HTML) from presentation (CSS).

Anyway - just something to stir into the pot!

In reply to Barry McMullin

Re: Latest plans for new themes and templates

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Basically it means we can still use tables, that's the main difference as far as I'm concerned. Personally, I'm not comfortable with completely dropping them, since table-less design is still so new and IE is still so painful at handling it.

Also, XHTML Strict implies that ALL content in a page will be strict, and given that teachers and students are editing the content this can not always be true.

Lastly, there can definitely be absolute separation of styles from the templates, this is true even of HTML 4. For example even the tables can be styled using CSS.

The very long and hard work will be converting to templates, so I want to do that first. Converting later from XHTML Transitional to XHTML Strict will be much, much easier and will be something that web designers with no knowledge of PHP can fiddle about with to their heart's content, since all they have to deal with will be XHTML files and CSS.
In reply to Martin Dougiamas

Re: Latest plans for new themes and templates

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
I was thinking about the necessary changes to the HTMLArea editor. Currently it may produce some unholy html mess, IMHO the users should be considerably restricted.

HTMLArea should support only formatting by styles or else the course content will not be compatible with the templates and CSS. I know many users that only Copy/Paste from MS Word and think that they are "making" good html sad


skodak
In reply to Petr Skoda

Re: Latest plans for new themes and templates

by David Scotson -
This is a big problem and it interacts with the user-selectable styles too, as you could use colored text in a posting unaware that someone else has chosen that as a background colour.

It's also what Craig and I are doing our talk about at MoodleMoot.

In reply to David Scotson

Re: Latest plans for new themes and templates

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I know at least one big site has disabled the HTML editor completely for everyone because of concerns like this.
In reply to Martin Dougiamas

Re: Latest plans for new themes and templates

by Barry McMullin -

Martin wrote:

I know at least one big site has disabled the HTML editor completely for everyone because of concerns like this.

Well, I can confirm that this is true of DCU at least. It is probably a somewhat hopeless gesture given the many other ways there are of generating bad html and getting it into Moodle. Still, it is a gesture which says something about what we want to achieve, and, if nothing else, generates some additional perspective for those staff and students who happen to enquire why we have this seemingly arcane policy...

In reply to Martin Dougiamas

Re: Latest plans for new themes and templates

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Here I go again....

<?xml version="1.0" ?>
<rant>

Here in sunny Glasgow, we have been doing a lot of work and research on tableless design and use of CSS in general. We are big enthusiasts and advocates, and I make no apology for that. My colleague David Scotson is a big-time CSS guru (if I wasn't working from home he'd be throwing things at me for that) and I am trying to persuade him to add some practical comments.

I would love to see, and will bore you to death by continuing to push for Moodle to adopt 'proper' XHTML and all the style stuff moved to CSS. I know it can be done, I know it will work across all common browsers, and I think it has big advantages for the future.

We will be happy to provide whatever practical assistance and advice that we can.

Oh, and I'm the biggest pragmatist going myself - so this isn't just hot air (this time) smile

</rant>
In reply to Howard Miller

Re: Latest plans for new themes and templates

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
"a lot of work and research"

Exactly my point. wink

But I will be very happy for you to adapt template/default into template/strict, if you're volunteering !!  smile
In reply to Martin Dougiamas

Re: Latest plans for new themes and templates

by David Scotson -

I see Howard has been talking me up, while I typed this reply, hopefully it won't be an anti-climax after all the hype.

I agree with Martin that XHTML transitional 1.0 is a valid and useful goal. To answer someone else's question it's main advantage over HTML 4 is that it is XML which allows it to be operated on as such with some slightly more advanced tools. It is appropriate to move to transitional for the very reason suggested in it's name, we are transitioning from having presentation in the HTML to having it purely in the CSS. It also aids backwards compatibility which might be important in many educational settings..

The debate about sending XHTML to browsers is usually focussed on whether the content is delivered to the browser to be interpreted as XML or HTML, (HTML being the smart choice) and even the XHTML spec has an appendix on how to write HTML compatible XHTML so it's not really controversial.

However, the comment about Strict not allowing tables is a touch off-base, since tables (and other tags that can be misused) are still present in XHTML 1.0 strict.

Full differences are listed here, note it's mainly about removing purely presentation based markup: http://liorean.web-graphics.com/xhtml/comparison.loose-strict.html

This brings up the issue of the difference between valid and semantically correct (X)HTML. The validator program can't tell if you're using a table for tabular data or to correctly line up some text with an image, or if you're using blockquote just to indent some text.

That is one of the reasons why the Accessibility standards checkers require human interaction to ensure that you aren't misusing tags for anything other than their correct semantic meaning.

I have various links to expand on this stuff but I wanted to throw this out before the developers meeting.

In reply to David Scotson

Re: Latest plans for new themes and templates

by Barry McMullin -

David Scotson wrote:

The debate about sending XHTML to browsers is usually focussed on whether the content is delivered to the browser to be interpreted as XML or HTML, (HTML being the smart choice) and even the XHTML spec has an appendix on how to write HTML compatible XHTML so it's not really controversial.

Well ... the point of this link was precisely to show that there is controversy; and that is among people who generally have a pretty good grasp of what they are talking about (IMHO).

But yes, OK, let's not flog that one here also. The main point is that we are all agreed (?) that, internally in Moodle (i.e., in the templates), we should standardize on XHTML (modulo the fact that any single template generally only provides a fragment, and that we are embedding Smarty code).

Given that, and if we can ensure that user provided content is similarly coerced into valid (albeit not semantically correct[1]) XHTML, then it becomes essentially trivial (!) to switch between delivering HTML or XHTML (or XHTML "backwards compatible") to the client side. For example, the PHP Tidy Extension should more or less do this trick, off the shelf. (That's a somewhat theoretical statment. I have used standalone tidy extensively to do this kind of transformation statically; I have not tried to do it dynamically on a production server!)

Actually, the PHP Tidy Extension is probably something we want to consider using anyway as a simple test/quality device during development. I notice there is already a canned output filter for Smarty...


[1] As David also implied in a couple of posts, the nature of user provided content is a whole other can of worms. Coercing into technically valid XHTML is probably the easiest part of that. Improvements to the embedded "rich text editor" may be a significant part of that particular jigsaw; but it is, anyway, a much bigger topic than design rules for the internal Moodle templates...

In reply to Barry McMullin

Re: Latest plans for new themes and templates

by David Scotson -
The link you provide is about HTML versus XHTML in respect to accessibility (at least as far as I read), but in my reply I was referring to disagreements over sending XHTML to browsers as XML versus HTML. The best summary of this argument I've found is here: http://www.hixie.ch/advocacy/xhtml (you may have to 'view source' to see that correctly in some browsers as it's just a text document).

And while the guy who wrote that really does know what he's talking about and says (basically) not to use XHTML, I've not seen many other people (again, looking to those who know what they're talking about) follow his lead. I get the feeling he's just being pedantic.

Given that the above seems to have been decided by general acclaim in XHTML's favour I'm not sure what the benefits are to creating XHTML and then delivering HTML. But I can see that it would add a layer of complexity when debugging layout issues and possibly be a drain on server resources.

I like XHTML, particularly for generated web pages, because it gives you another level of error checking because the page should at least be valid XML. Kind of like using a compiled language, you can catch a whole range of stupid errors at an early stage. It also allows you to use a variety of clever tools e.g. easy translation from XML via XSLT and seems in general to be more 'programmer friendly'.

I favour transitional rather than strict because I don't think it is wise to do everything at once. Since Moodle is made up from many different components it will be easier to get them validating at the transitional stage and the sooner it validates the better. The jump to cleanly separated presentation and structure can wait until after the more mechanical and straightforward translation of invalid HTML -> validating XHTML.
In reply to Barry McMullin

(tidy) Re: Latest plans for new themes and templates

by Michael Champanis -
mod-tidy is quite useful from a development perseptive, all your pages get checked all of the time, so you can easily see if you've introduced non-compliant markup anywhere. Probably not good for production servers though ;P

http://mod-tidy.sourceforge.net/
In reply to Martin Dougiamas

Re: Latest plans for new themes and templates

by Barry McMullin -

Martin wrote (in arguing against my proposal that the template design rule should be X/HTML strict rather than transitional):

Basically it means we can still use tables, that's the main difference as far as I'm concerned. Personally, I'm not comfortable with completely dropping them, since table-less design is still so new and IE is still so painful at handling it.

Also, XHTML Strict implies that ALL content in a page will be strict, and given that teachers and students are editing the content this can not always be true.

Lastly, there can definitely be absolute separation of styles from the templates, this is true even of HTML 4. For example even the tables can be styled using CSS.

I'm sorry for harping on about this, but I do think it's worth investing a little effort in teasing out now, before template design is substantially underway, rather than coming back to it later.

As David has pointed out, the distinction between using tables for layout versus CSS for layout is essentially separate from using strict or transitional X/HTML. True, "philosophically", using tables for layout is rather against the "spirit" of strict HTML (which basically is trying to push all styling, which would ultimately include layout, out of HTML and into CSS). But there is no technical conflict: one can certainly use tables for layout in completely valid X/HTML strict. So, since Martin goes on to acknowledge that all table "styling" can be in CSS, there is no argument here for transitional over strict.

Whether or not to actually use tables for layout is another question; my point here is simply to emphasise that it is another question, and shouldn't muddy the debate about strict versus transitional.

Secondly, Martin makes the very good point that even if the templates produced X/HTML conforming to a strict DTD, the included user content may well violate this again. This is very true. But it also again largely transcends the strict versus transitional question. User content may well be "bad" in lots of different ways, and if we don't do anything on the server side to control for that, then we won't be able to deliver valid HTML of any kind. OK, transitional is more "relaxed", so there is a better "chance" of not generating bad code if we label conservatively as transitional rather than strict. But I basically agree with Petr that this is a separate problem, that needs to be addressed separately. In any case, even if we wind up labelling the code sent to the client side as transitional, just to allow for poor mark-up quality of user content, that is hardly an argument for endorsing the use of transitional markup in the templates as a matter of design policy?

Finally, Martin writes:

The very long and hard work will be converting to templates, so I want to do that first. Converting later from XHTML Transitional to XHTML Strict will be much, much easier and will be something that web designers with no knowledge of PHP can fiddle about with to their heart's content, since all they have to deal with will be XHTML files and CSS.

So, again I want to (respectfully!) register my disagreement - and I'm acutely mindful of the fact that it is other people, not me, who are generously stepping up to the plate to actually do this work. And yes, converting to a templated architecture is going to be long and hard work. But it just is not apparent to me that that is going to be made any less so by allowing transitional html in the templates. (Again, the issue of tables vs. CSS for layout is another, but disjoint, question.) I may be completely missing the point here (and please, somebody clobber me, if I am!) but I don't yet understand any specific feature of transitional HTML that it is actually desirable to retain in the templates...

In reply to Barry McMullin

Re: Latest plans for new themes and templates

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Don't worry, Barry, there will not be any styling that is not in the CSS stylesheets.

The only point I really wanted to make was that I want to use some tables for layout where appropriate, and that is all. All the tags used will be 100% strict XHTML and CSS will be used for all the styling.

The only reason I mentioned Transitional was to allow browsers to be flexible about things, but that doesn't mean we have to be.   I also mistakenly thought table-layout was disallowed in Strict but I now understand it's only breaking conventions rather than rules.
In reply to Martin Dougiamas

Re: Latest plans for new themes and templates

by David Scotson -
I would highly recommend reading the sample chapters of the book "Designing With Web Standards" by Jeffrey Zeldman available here: http://www.zeldman.com/dwws/

The two freely available chapters walk through what he refers to as a 'transitional design' i.e. something that uses a minimum number of tables for the basic structure but delegates the majority of the styling to CSS.

He also talks about why he continues to use the bgcolor attribute in XHTML transitional even though it 'could get us thrown out of the Pure Standards Academy' and drops in a variety of accessibility tips too.

The entire book is highly recommended.