[PHP] Ouput HTML w/PHP
And now for something completely different... I have a question that has been nagging at me. I've searched the archives, FAQs, and web sites, but haven't found an answer. I have two ways that I've output HTML with PHP; one is to write the HTML, using the PHP tags to execute code when necessary. The other is to store the entire HTML output file in a string variable with concatenation and call the print (or echo) function at the bottom to output the page. Are there advantages one way or the other? This leads (sort of) to a second question: how can I validate my HTML? My applications run on an intranet (with database access), so I can't use the W3C Validator to point to the URL. If I try to upload the file, the validator doesn't parse the PHP to get the HTML output (which is why I wonder if I'm not better writing the HTML and sticking PHP where it's needed). Is there a way for me to maybe use the PHP tidy functions on the string containing the HTML ouput to validate it? Thanks in advance, Rick -- Rick Emery When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for there you have been, and there you will always long to return -- Leonardo Da Vinci -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ouput HTML w/PHP
On Thursday 30 June 2005 13:50, Rick Emery typed: the validator doesn't parse the PHP to get the HTML output (which is why I wonder if I'm not better writing the HTML and sticking PHP where it's needed). Is there a way for me to maybe use the PHP tidy functions on the string containing the HTML ouput to validate it? When I do this, I browse each page, doing File Save. Then using the form upload of the W3C validator, validate each page. Since I use templates, fixing each template tends to fix lots of other pages. -- My mind not only wanders, it sometimes leaves completely. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ouput HTML w/PHP
On Thu, 2005-06-30 at 08:50 -0400, Rick Emery wrote: And now for something completely different... I have a question that has been nagging at me. I've searched the archives, FAQs, and web sites, but haven't found an answer. I have two ways that I've output HTML with PHP; one is to write the HTML, using the PHP tags to execute code when necessary. The other is to store the entire HTML output file in a string variable with concatenation and call the print (or echo) function at the bottom to output the page. Are there advantages one way or the other? This leads (sort of) to a second question: how can I validate my HTML? My applications run on an intranet (with database access), so I can't use the W3C Validator to point to the URL. If I try to upload the file, the validator doesn't parse the PHP to get the HTML output (which is why I wonder if I'm not better writing the HTML and sticking PHP where it's needed). Is there a way for me to maybe use the PHP tidy functions on the string containing the HTML ouput to validate it? Thanks in advance, Rick -- Rick Emery When once you have tasted flight, you will forever walk the Earth with your eyes turned skyward, for there you have been, and there you will always long to return -- Leonardo Da Vinci What I usually do is to use smarty. There is a lite version that does just fine, and has a very small memory print. Usually, my last lines of code are something like: ... $RenderResult = $Template-fetch('template.tpl'); /* Do something if I need to */ echo $RenderResult; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ouput HTML w/PHP
On Thu, June 30, 2005 5:50 am, Rick Emery said: This leads (sort of) to a second question: how can I validate my HTML? My applications run on an intranet (with database access), so I can't use the W3C Validator to point to the URL. If I try to upload the file, the validator doesn't parse the PHP to get the HTML output (which is why I wonder if I'm not better writing the HTML and sticking PHP where it's needed). Is there a way for me to maybe use the PHP tidy functions on the string containing the HTML ouput to validate it? You could use ob_start() and then get the contents and run them through Tidy before displaying. You could also hack something up with wget (or similar) to get your PHP output to the validator. To expand on this theme a bit... Anybody know of an application which: can be run from command line as a cron job gets HTTP output (possibly from intranet, possibly from internet) maybe even crawls a whole site (stay in my domain name) feed output to user-selected validator (w3c, webmonkey, local application) notifies webmaster of problems In an ideal world: Problem lines would be run through diff and the application would assume (probably correctly) that only the first instance of a problem needs to be reported. I don't need 1893 complaints about the screwup on a template page for a store with 1893 Products. The user could flag certain output from the brain-dead validators as non-issue Example: I really don't *care* that the BODY attributes I use to get rid of borders in the content area only work in some browsers and aren't W3C kosher. THEY WORK! Unlike the nightmare that is CSS in its current implementations. My long-term goal is to crawl my own sites, in a cron job, and nag the hell out of me about any missing closing tags. Maybe a super long-term dream goal is to get to W3C compliance, but only after the browsers fix their CSS implementation, so I got a lot of breathing room there... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php