Re: Re: Methods for creating HTML with PHP
| From: | Jason Giangrande | Date: | Fri, 26 Mar 2004 03:40:08 +0000 |
| Subject: | Re: Re: Methods for creating HTML with PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181540@lists.php.net to get a copy of this message | ||
Justin French wrote:
On Friday, March 26, 2004, at 04:47 AM, Resell Domain Names wrote:I do understand that PHP and HTML can be mixed together. That's how I've been coding with it for the last nine months. My question was is there a viable solution to mixing PHP and HTML code. I think mixing PHP and HTML code can get a little confusing. I can understand it when I write it, but a few months down the road it will take me a little while to figure out what the script is doing since I need to mentally separate the HTML code from the PHP code. As I stated in past posts I have yet to find a decent solution for handle the building of an HTML page with PHP. I tried HTML_Page from PEAR, but it still needs some work before it is fully usable. I also contemplated writing my own HTML class, but so far the only workable solution I have come up with is pretty much what HTML_Page already does.Why not use Smarty or another template engine? (http://smarty.php.net/)Smarty has a lot of overhead. PHP is a perfectly good templating engine all by itself. What the OP may or may not have understood is that PHP and HTML can be mixed together:
---
<html>
<body>
<div id='content'>
<?=$content?>
</div>
</body>
</html>
---
As for Smarty, well, anything it can do, PHP can do better and faster, without the overhead :)
Personally I've used Smarty only a little. It has it purposes in some situations, but since I know PHP (somewhat anyway :-D) I wouldn't need it for most projects.
--
Jason Giangrande <jason@giangrande.org>
http://www.giangrande.org
http://www.dogsiview.com