Re: Question about templates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sure if all you are writing is a "hello world" page, but if you are writing out an application that is more complex, wouldn't the savings and managability be beneficial enough to justify? ... code reusability ... Don't ya think?

Why is it easier to do something like this:

echo '<table>';
echo '<tr>';
   while (...) {
echo '<td>$row['name']</td><td>$row['location']</td><td>$row['phone']</td><td>$row['fax']</td>';
   }
echo '</tr>';
echo '</table>';

as opposed to this:

$table->open_table();
   while (...) {
       $table->new_row($row);
   }

Of course it doesn't account for object, and the separate template file, but that is reusable. I don't know the syntax of smarty, but isn't it a similar thing? You define an HTML template and deliver the object contents upon rendering output? I have to look at Smarty more. I have used PHPBB which uses a symilar syntax (I think). I like that sort of template system. It seems logical to me.

-Brian

Kevin Waterson wrote:
This one time, at band camp, Charlene Wroblewski <cwemagazines@xxxxxxxxxxx> wrote:

looked at Smarty and it doesn't seem to be as useful the way I'm using templates.

I'm not surprised, 1000 lines of code to do "hello world"

Kevin

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux