From: Todd O. <to...@da...> - 2001-04-02 17:42:36
|
> I think we should code according to PEAR standards. I agree, but there are some things that aren't addressed in PEAR (at least yet). Most of the HTML markup is in echo statements now. I that what we want to continue to do? BinaryCloud.com and many others believe that there should not be ANY echo or print statements. This from BinaryCloud: ---Markup --Global Rules -Do not use echo or print for markup. Using echo & print obscures the markup, is time consuming to edit, is error prone, and will impede the progress of any project where non-php authors are involved. -Do not include complex logic in template files. Conditionals are the most complex logic allowed in templates. If you need to loop through an array, do it in the module, and call the template function recursively. -Declare all of your variables at the top, right under the function. Don't get globals, etc inside the code. In other words, do all of your setup at the top of the file. -It is nice if comments are wrapped to 80 chars, you'll probably get in the habit anyway - but it is not necessary. Tags cannot and should not be wrapped to 80 chars. Note that this standard applies to _all_ markup: html, wml, xml, etc. -This is a complex example, because this would be used as a 'master' template for a site. Template files associated with modules should be simple, and light on php code. They should not scare people who only know html. -Note the conspicuous absence of any comment header for the template function. Master templates must all use $tmpl_obj to get their list of modules, and some other miscellaneous values like page title, etc. It is not necessary to document this in every file, and adds quite a lot of redundant comments to the phtml masters. -Your module phtml files should be so simple and light on php logic that commenting them seems like a waste of time. (and is) -Every file must contain a header -You must place an html comment at the top & bottom of the html with the path to the file. (see format below) -Use html comments _ONLY_ when you are printing html. If the comment is about PHP code, use PHP comments. The purpose of the html comments is to allow html authors to locate code embedded in complex pages, so they can fix it easily. Diagnostic information is the only exception. Comments anyone, anyone... --Todd |