Re: [WSG] Standards-based PHP tutorials for beginners...
Thanks Dylan, Joshua and Nick (and Amit), for the info! Talk about 6-degrees of separation between the backend and presentation :) I'm currently facilitating a class learning HTML/CSS/JavaScript as part of a Certificate IV in WebDesign. We've been learning XHTML 1.0 from the start, separating our content/presentation etc., hopefully now as second nature! Now we spend the next 8 weeks or so learning PHP and I'm just rethinking the approach that I've used in the past. Normally we use Larry Ullman's Visual Quick-start guide, as it doesn't assume programming knowledge and is activity based, but it is usually a bit behind (such as not using super-globals $_POST etc). As the Certificate IV course is only 6 months in duration, we really need to stick to the basics of creating a small dynamic site (atm using PHP/MySQL), as the course does not assume prior programming knowledge. Anyway, thanks for all the ideas! I'd certainly like to integrate more XML and xml transforms into the course (currently we only get an overview of XML and its applications such as SVG, SMIL, RSS, XHTML etc). If you have any further ideas, please send them my way! -Michael On Thu, 2004-09-09 at 10:40, Dylan Egan wrote: > Hi, > > >Couldn't agree more. One other suggestion, though, is to extend that > >separation a little further by generating XML with PHP, and then parsing > >that XML into whatever templating engine you end up using. This just > >provides another degree of separation, and reduces the temptation to > >hard-code ANY HTML into your back-end... something which I wish I'd been > >aware of 6 months ago! > > > > > This would be the best choice too, im currently working on a CMS and > we're going to be using XML for the data and straight up XSL for the > transformation (only because PHP5 has great XML capabilities). This > allows us to seperate data from structure. > > >Having your content available in XML will also simplify the presentation > >of content in other formats in the future, if you choose to do so -- > >thinking of syndication (RSS) amongst other things. > > > > > Or converting to WML, or back to plain HTML. > > >>From a standards perspective, this separation just reduces the chance of > >making some early mistakes which will take ages to correct six months > >down the track. > > > > > Just make sure you study the best choices. > > >Joshua Street > > > > > > > > ** > The discussion list for http://webstandardsgroup.org/ > > Proud presenters of Web Essentials 04 http://we04.com/ > Web standards, accessibility, inspiration, knowledge > To be held in Sydney, September 30 and October 1, 2004 > > See http://webstandardsgroup.org/mail/guidelines.cfm > for some hints on posting to the list & getting help > ** > ** The discussion list for http://webstandardsgroup.org/ Proud presenters of Web Essentials 04 http://we04.com/ Web standards, accessibility, inspiration, knowledge To be held in Sydney, September 30 and October 1, 2004 See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help **
Re: [WSG] Standards-based PHP tutorials for beginners...
Hi Joshua, Why did you choose to go the XML route and in what way? I went down a similar path with earlier versions of systems I'd built, however, I didn't use XSLT which I'm guessing is how you're doing it. To keep this on topic I'm asking because clean XHTML used with CSS allows data that is already marked up with a fairly basic XML flavour. Isn't it simply faster to go straight from PHP to XHTML or XML (e.g. RDF, RSS), etc., templates as needed. A site I'm currently building a content management system for has some templates that are RDF for a newsfeed and others that are XHTML. I suppose what I'm curious about is why go from PHP to XML then on to e.g XHTML (a form of XML), RDF (a form of XML), etc. If you're storing data as XML it isn't intrinsically better than storing it in a database it's just one way of doing it. In somewhat the same way semantically marked up XHTML pages are in a sense XML stored data. CSS itself can then be used to repurpose those pages to some degree. I'm not by the way disputing your suggestion as each situation has different needs and we all make our own judgement. With regards to Michael's original question I would be cautious with being as specific as saying XML at this stage. I'd err on the simpler suggestion to keep the data-source, functionality/logic and presentation separate. Nick Couldn't agree more. One other suggestion, though, is to extend that separation a little further by generating XML with PHP, and then parsing that XML into whatever templating engine you end up using. This just provides another degree of separation, and reduces the temptation to hard-code ANY HTML into your back-end... something which I wish I'd been aware of 6 months ago! Having your content available in XML will also simplify the presentation of content in other formats in the future, if you choose to do so -- thinking of syndication (RSS) amongst other things. From a standards perspective, this separation just reduces the chance of making some early mistakes which will take ages to correct six months down the track. Joshua Street ** The discussion list for http://webstandardsgroup.org/ Proud presenters of Web Essentials 04 http://we04.com/ Web standards, accessibility, inspiration, knowledge To be held in Sydney, September 30 and October 1, 2004 See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help **
Re: [WSG] Standards-based PHP tutorials for beginners...
I know what you mean. When I originally started SS Coding with PERL I used templates for EVERYTHING... Then i learnt PHP, and integrated HTML into EVERYTHING! Now I still integrate HTML but differntly. I have 4 basic PHP files. _build_start _build_header _build_footer _build_end start and end are SQL and functions etc... while header and footer are pure HTML the only thing between those 4 things is the generated content. which is pure html output. but since CSS takes over. its usually just a and a few tags etc... a and here and there. Makes life really simple, no templates to deal with! Joshua Street wrote: Couldn't agree more. One other suggestion, though, is to extend that separation a little further by generating XML with PHP, and then parsing that XML into whatever templating engine you end up using. This just provides another degree of separation, and reduces the temptation to hard-code ANY HTML into your back-end... something which I wish I'd been aware of 6 months ago! Having your content available in XML will also simplify the presentation of content in other formats in the future, if you choose to do so -- thinking of syndication (RSS) amongst other things. From a standards perspective, this separation just reduces the chance of making some early mistakes which will take ages to correct six months down the track. Joshua Street base10solutions Website: http://www.base10solutions.com/ Phone: (02) 9898-0060 Fax: (02) 8572-6021 Mobile: 0425 808 469 E-mails and any attachments sent from base10solutions are to be regarded as confidential. Please do not distribute or publish any of the contents of this e-mail without the senderĂ¢s consent. If you have received this e-mail in error, please notify the sender by replying to the e-mail, and then delete the message without making copies or using it in any way. Although base10solutions takes precautions to ensure that e-mail sent from our accounts are free of viruses, we encourage recipients to undertake their own virus scan on each e-mail before opening, as base10solutions accepts no responsibility for loss or damage caused by the contents of this e-mail. On Thu, 2004-09-09 at 09:55, Nick Lo wrote: Hi Michael, One thing I'd suggest if you're learning PHP is to from the very start try as much as possible to avoid having PHP generate your HTML (as in your example). I started coding PHP over 4 years ago using an e-commerce system that generated large amounts of the HTML and I still now have to occasionally work on it. I can tell you that debugging HTML is a scary task when it is being generated all over the place. It's a frequent complaint that database-driven/content-managed/whatever sites produce horrible HTML because of their "engines". This is not really the right list for too much discussion on PHP itself but I'd suggest you separate out your HTML into "templates" which can be done using template engines as tricky (and some say overkill) as Smarty or as simple as using in your HTML. The important thing being to only allow php code in your HTML that is responsible for actually generating the HTML. e.g. not database queries. In fact I was recently doing a quick update on the above system and realised the one improvement I'd do first would be to separate out the HTML as much as possible. A great place to get some idea of the approaches is sitepoint.com PHP forums; search for "php template" or similar. I'll not go too far into the nitty-gritties as it could drift off-topic. I do however think that the way a lot of systems are built does make building valid standards compliant sites very difficult if not done carefully. Nick ... a bit much to ask? Just wondering if anyone knew of any such tutorials. Those on php.net seem as if they were written by C programmers wanting to learn php. Yet those on webmonkey are so old that they still use things like: echo "Hi there"; Makes it very hard to help HTML newbies (who've learned standards-based html from the start) learn PHP! The best I could find was: http://www.free2code.net/tutorials/programming/php/4/ Introduction_to_PHP.php Any suggestions welcome! -Michael ** The discussion list for http://webstandardsgroup.org/ Proud presenters of Web Essentials 04 http://we04.com/ Web standards, accessibility, inspiration, knowledge To be held in Sydney, September 30 and October 1, 2004 See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help ** ** The discussion list for http://webstandardsgroup.org/ Proud presenters of Web Essentials 04 http://we04.com/ Web standards, accessibility, inspiration, knowledge To be held in Sydney, September 30 and October 1, 2004 See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & get
Re: [WSG] Standards-based PHP tutorials for beginners...
Hi, Couldn't agree more. One other suggestion, though, is to extend that separation a little further by generating XML with PHP, and then parsing that XML into whatever templating engine you end up using. This just provides another degree of separation, and reduces the temptation to hard-code ANY HTML into your back-end... something which I wish I'd been aware of 6 months ago! This would be the best choice too, im currently working on a CMS and we're going to be using XML for the data and straight up XSL for the transformation (only because PHP5 has great XML capabilities). This allows us to seperate data from structure. Having your content available in XML will also simplify the presentation of content in other formats in the future, if you choose to do so -- thinking of syndication (RSS) amongst other things. Or converting to WML, or back to plain HTML. From a standards perspective, this separation just reduces the chance of making some early mistakes which will take ages to correct six months down the track. Just make sure you study the best choices. Joshua Street ** The discussion list for http://webstandardsgroup.org/ Proud presenters of Web Essentials 04 http://we04.com/ Web standards, accessibility, inspiration, knowledge To be held in Sydney, September 30 and October 1, 2004 See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help **
Re: [WSG] Standards-based PHP tutorials for beginners...
Couldn't agree more. One other suggestion, though, is to extend that separation a little further by generating XML with PHP, and then parsing that XML into whatever templating engine you end up using. This just provides another degree of separation, and reduces the temptation to hard-code ANY HTML into your back-end... something which I wish I'd been aware of 6 months ago! Having your content available in XML will also simplify the presentation of content in other formats in the future, if you choose to do so -- thinking of syndication (RSS) amongst other things. >From a standards perspective, this separation just reduces the chance of making some early mistakes which will take ages to correct six months down the track. Joshua Street base10solutions Website: http://www.base10solutions.com/ Phone: (02) 9898-0060 Fax: (02) 8572-6021 Mobile: 0425 808 469 E-mails and any attachments sent from base10solutions are to be regarded as confidential. Please do not distribute or publish any of the contents of this e-mail without the senderĂ¢s consent. If you have received this e-mail in error, please notify the sender by replying to the e-mail, and then delete the message without making copies or using it in any way. Although base10solutions takes precautions to ensure that e-mail sent from our accounts are free of viruses, we encourage recipients to undertake their own virus scan on each e-mail before opening, as base10solutions accepts no responsibility for loss or damage caused by the contents of this e-mail. On Thu, 2004-09-09 at 09:55, Nick Lo wrote: > Hi Michael, > > One thing I'd suggest if you're learning PHP is to from the very start > try as much as possible to avoid having PHP generate your HTML (as in > your example). > > I started coding PHP over 4 years ago using an e-commerce system that > generated large amounts of the HTML and I still now have to > occasionally work on it. I can tell you that debugging HTML is a scary > task when it is being generated all over the place. It's a frequent > complaint that database-driven/content-managed/whatever sites produce > horrible HTML because of their "engines". > > This is not really the right list for too much discussion on PHP itself > but I'd suggest you separate out your HTML into "templates" which can > be done using template engines as tricky (and some say overkill) as > Smarty or as simple as using in your HTML. The > important thing being to only allow php code in your HTML that is > responsible for actually generating the HTML. e.g. not database > queries. In fact I was recently doing a quick update on the above > system and realised the one improvement I'd do first would be to > separate out the HTML as much as possible. A great place to get some > idea of the approaches is sitepoint.com PHP forums; search for "php > template" or similar. > > I'll not go too far into the nitty-gritties as it could drift > off-topic. I do however think that the way a lot of systems are built > does make building valid standards compliant sites very difficult if > not done carefully. > > Nick > > > ... a bit much to ask? > > > > Just wondering if anyone knew of any such tutorials. Those on php.net > > seem as if they were written by C programmers wanting to learn php. Yet > > those on webmonkey are so old that they still use things like: > > > > echo "Hi there"; > > > > Makes it very hard to help HTML newbies (who've learned standards-based > > html from the start) learn PHP! > > > > The best I could find was: > > http://www.free2code.net/tutorials/programming/php/4/ > > Introduction_to_PHP.php > > > > Any suggestions welcome! > > -Michael > > ** > The discussion list for http://webstandardsgroup.org/ > > Proud presenters of Web Essentials 04 http://we04.com/ > Web standards, accessibility, inspiration, knowledge > To be held in Sydney, September 30 and October 1, 2004 > > See http://webstandardsgroup.org/mail/guidelines.cfm > for some hints on posting to the list & getting help > ** ** The discussion list for http://webstandardsgroup.org/ Proud presenters of Web Essentials 04 http://we04.com/ Web standards, accessibility, inspiration, knowledge To be held in Sydney, September 30 and October 1, 2004 See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help **
Re: [WSG] Standards-based PHP tutorials for beginners...
Hi Michael, One thing I'd suggest if you're learning PHP is to from the very start try as much as possible to avoid having PHP generate your HTML (as in your example). I started coding PHP over 4 years ago using an e-commerce system that generated large amounts of the HTML and I still now have to occasionally work on it. I can tell you that debugging HTML is a scary task when it is being generated all over the place. It's a frequent complaint that database-driven/content-managed/whatever sites produce horrible HTML because of their "engines". This is not really the right list for too much discussion on PHP itself but I'd suggest you separate out your HTML into "templates" which can be done using template engines as tricky (and some say overkill) as Smarty or as simple as using in your HTML. The important thing being to only allow php code in your HTML that is responsible for actually generating the HTML. e.g. not database queries. In fact I was recently doing a quick update on the above system and realised the one improvement I'd do first would be to separate out the HTML as much as possible. A great place to get some idea of the approaches is sitepoint.com PHP forums; search for "php template" or similar. I'll not go too far into the nitty-gritties as it could drift off-topic. I do however think that the way a lot of systems are built does make building valid standards compliant sites very difficult if not done carefully. Nick ... a bit much to ask? Just wondering if anyone knew of any such tutorials. Those on php.net seem as if they were written by C programmers wanting to learn php. Yet those on webmonkey are so old that they still use things like: echo "Hi there"; Makes it very hard to help HTML newbies (who've learned standards-based html from the start) learn PHP! The best I could find was: http://www.free2code.net/tutorials/programming/php/4/ Introduction_to_PHP.php Any suggestions welcome! -Michael ** The discussion list for http://webstandardsgroup.org/ Proud presenters of Web Essentials 04 http://we04.com/ Web standards, accessibility, inspiration, knowledge To be held in Sydney, September 30 and October 1, 2004 See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help **
Re: [WSG] Standards-based PHP tutorials for beginners...
Hi Michael, This is what you are looking for: http://www.juicystudio.com/tutorial/php/index.asp Regards, -Vlad http://xstandard.com - Original Message - From: "Michael Nelson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, September 07, 2004 7:39 PM Subject: [WSG] Standards-based PHP tutorials for beginners... > ... a bit much to ask? > > Just wondering if anyone knew of any such tutorials. Those on php.net > seem as if they were written by C programmers wanting to learn php. Yet > those on webmonkey are so old that they still use things like: > > echo "Hi there"; > > Makes it very hard to help HTML newbies (who've learned standards-based > html from the start) learn PHP! > > The best I could find was: > http://www.free2code.net/tutorials/programming/php/4/Introduction_to_PHP.php > > Any suggestions welcome! > -Michael > > ** > The discussion list for http://webstandardsgroup.org/ > > Proud presenters of Web Essentials 04 http://we04.com/ > Web standards, accessibility, inspiration, knowledge > To be held in Sydney, September 30 and October 1, 2004 > > See http://webstandardsgroup.org/mail/guidelines.cfm > for some hints on posting to the list & getting help > ** > > ** The discussion list for http://webstandardsgroup.org/ Proud presenters of Web Essentials 04 http://we04.com/ Web standards, accessibility, inspiration, knowledge To be held in Sydney, September 30 and October 1, 2004 See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help **