Templates Status?

Templates Status?

by Howard Miller -
Number of replies: 12
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
What is the status of the new templates stuff?

I was going to look at a little module project I have been thinking about, but if every-thing's going to be different because of templates I may well hold off for now. What's the advice on writing new addons at the moment?

Thanks!
Average of ratings: -
In reply to Howard Miller

Re: Templates Status?

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
The status is pain. 

I got a bit bogged down because of forms ... I'm planning to use this class for them.

I'll persevere with the whole thing a bit longer then I might need to re-evaluate the practicality of the whole approach ... it's VERY tempting just to leave all the HTML and PHP mixed up as it is and just work on improving it into one set of good XHTML and CSS.
In reply to Martin Dougiamas

Re: Templates Status?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
What happened to Smarty? No, hang on, I've read the stuff now - I geddit - it sems based on Smarty?!?!

Anyway, would it not be easier to establish a framework (that works) and then get others to help convert individual modules and such. Your not planning on doing it all yourself are you? dead
In reply to Howard Miller

Re: Templates Status?

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
It's the framework details that I'm working on, yes.  Then I'll publish an example and a step-by-step guide to converting.
In reply to Martin Dougiamas

Re: Templates Status?

by David Scotson -
I can wait for the step-by-step guide, but just in case there is a short answer (or a webpage you can point me to): How is translation to other languages going to work? I never managed to wrap my head around internationalization with Smarty.
In reply to David Scotson

Re: Templates Status?

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
Just like now, Moodle gets all the strings it needs for that page and sends them to the current template (which simply plugs them in to the page as appropriate)
In reply to Martin Dougiamas

Templates pain will be worth it

by Gustav W Delius -

Martin,

I just wanted to let you know that we appreciate the effort you are putting into converting Moodle to templates. I think it will be very worthwhile. One reason I am looking forward to it for example is that templates would allow us to provide nicely typeset printed question sheets from the quiz module simply by changing the template. But that is only one example of the things that will be possible. Another reason of course are the legal accessibility requirements. It will be easier to satisfy them with templates, especially if the requirements change due to changes in technology it will be easy to adapt.

In reply to Gustav W Delius

Re: Templates pain will be worth it

by Ray Lawrence -
At the risk of sounding a bit licky, I'd like to second those sentiments.
In reply to Martin Dougiamas

Re: Templates Status?

by Hannes Gassert -
Are you sure you want to use a class by Mr. Lemos? I guess you know about his ill repute in the PHP community and the constant trouble with this guy?
It's your decision of course, but http://pear.php.net/package/HTML_QuickForm could be a wiser choice smile

Regards,
Hannes (who would have went straight for XSL for templates wink)
In reply to Hannes Gassert

Re: Templates Status?

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
HTML_Quickform looks good. I wasn't aware of that one - thanks! Even found a nice tutorial.

Have you used this package? (and for that matter have you ever used XSL for templates?)

Yes, I've seen some of the clashes between Lemos in the PHP mailing lists, but his personality is not really relevant ... the code itself is well-thought-out and seemingly quite widely used.
In reply to Martin Dougiamas

Re: Templates Status?

by Hannes Gassert -
I have not used this package myself, but trust the people that recommended it to me smile
There are some more tutorials linked on http://www.phpkitchen.com/staticpages/index.php?page=2003041204203962, and in fact I give it a big bonus because it's in PEAR - not only because I think there is a certain amount of quality control and peer review, but also because of the PEAR infrastructure: bug tracker for each package, apidocs, installer.. etc., and no registration, ads and all that. I'd love to see Moodle use more of PEAR instead of taking libraries from all over the place (not meant offensive..).

As far as XSLT is concerned: My company does not use anything else any more (expect for Moodle smile). Popoon ("Cocoon for PHP") is one of the ways to go in my eyes (alright, as a contributor to Popoon I might be a bit biased wink). XSL has quite a high entry barrier, getting into simple templates is a lot easier for most people, therefore it might very well be just too much for Moodle. But it certainly is great, elegant, etc.

And about Lemos: Just pray you will never have him here! smile

But as said: It really is your decision, either way means lots of work...for you, I guess.
In reply to Howard Miller

Re: Templates Status?

by Gustav W Delius -
I think that it is important that Moodle moves towards templates. At least all new development should start using the template mechanism. Martin, did you get any further with writing an example and some guidelines on how we should use Smarty? (Sorry for asking now, I know you are busy with Moodle 1.4.2, I don't expect an answer immediately).
In reply to Gustav W Delius

Re: Templates Status?

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
The urgent need is for XHTML and better styles (which help everyone immediately) ... this work is proceeding pretty fast so far without templates.

Once that's done I am intending to start gradually converting things to templates (to help the developers).

If I could send the rest of the world away on a lightspeed trip for a day then I could have a nice quiet year all by myself to do everything I want done! smile