You are here: Re: [PHP] Ouput HTML w/PHP « PHP « IT news, forums, messages
Re: [PHP] Ouput HTML w/PHP

Posted by Andrι Medeiros on 06/30/05 20:27

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;
?>

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация