Ben said:
> But i don't see an alternative in your "Example 3".

Here was example 3 from my post:
http://marc.theaimsgroup.com/?l=php-general&m=108145205519710&w=2

$result = mysql_query ("SELECT * FROM users WHERE id = '".$_GET["id"]."');
$row_array = mysql_fetch_array ($result);
$name    = $row_array["name"];
$address = $row_array["address"];
$state   = $row_array["state"];
$include("template.tpl");
---
<html>
<body>
Name: <?=$name;?><br>
Address: <?=$address;?><br>
State: <?=$state;?><br>
...

By the way, that's 2 files you're looking at; something like index.php and
template.tpl.

Looks rather templaty, dontcha think?  PHP was originally intended to be a
template engine (or so I've been told).

> I hate that coding mixed up with the rest of HTML/CSS.

Me too, which is why I went to Smarty, but then I realized I could do the
same thing without Smarty.  Not that Smarty is bad (I'll probably use it
in the future) but I don't *need* it to separate business and presentation
logic and neither do you.

For further separation of design from markup, check out CSSZenGarden.com
for about 200 amazing designs done entirely with CSS.  Seems there's no
limits to the design capabilities of CSS, including replacing HTML tables
and img tags.

Ultimately you could separate your entire website into CSS for design,
HTML for the markup of the data, PHP for getting the data, etc.  Very
nice.

> It may be fact, that the perfomance could get worse a bit
> when using smarty* but since your not coding sth. for a high
> traffic site the usability of code is more important than that
> little peace of loss in performance.

I agree.  The ease-of-use that templating affords is a good tradeoff for
the slight performance hit.  Smarty does precompile the PHP and offers
caching, which helps... it's probably similar in performance to the native
PHP template method described above.  With native PHP I can use buffering
and Zend and other native performance goodness so native PHP is almost
certainly going to be faster in nearly every case.  Just my guess.

Overall, I'd use Smarty when I want to get the extra functions and widgets
in one library.  It's a great tool.

/dev/idal

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to