Perfection and code readability
Posted: Wed Jan 29, 2003 1:42 pm
I decided to check out phpBB under the hood.
Now, I am Amazed about how cleanly it is written. I always wondered why my own projects end up looking bloated...
I guess the greatest reason to that is that I use to output HTML with PHP in the same php-file where the server automation is performed.
Well, phpBB (including this forum) is not. phpBB is class oriented and the actual presentation is done like this:...
...
So... They are actually parsing a template using PHP...
That is so rigid, it must have taken much effort to design the model from wich they worked it out.
Code is separate from design.
Automation is never bloated with HTML rubbish.
What about performance?
The PHP files can be cached using PHP Accelerator, but are the template files cached in any way? I guess not. People always tell me it is faster to query a DB for some text than opening a file and retrieving the data from there.
Maybe I should do some benchmarking myself before saying it is so...
I guess templates can be read once and inserted into the DB with a special admin "scan for templates" command and thus increasing performance.
I don't have a well defined question about this, but I would like to start a thread about perfection of php usage.
Now, I am Amazed about how cleanly it is written. I always wondered why my own projects end up looking bloated...
I guess the greatest reason to that is that I use to output HTML with PHP in the same php-file where the server automation is performed.
Well, phpBB (including this forum) is not. phpBB is class oriented and the actual presentation is done like this:
Code: Select all
<?php
//blablabla
//
// Generate the page
//
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
//blablabla
?>So... They are actually parsing a template using PHP...
That is so rigid, it must have taken much effort to design the model from wich they worked it out.
Code is separate from design.
Automation is never bloated with HTML rubbish.
What about performance?
The PHP files can be cached using PHP Accelerator, but are the template files cached in any way? I guess not. People always tell me it is faster to query a DB for some text than opening a file and retrieving the data from there.
I guess templates can be read once and inserted into the DB with a special admin "scan for templates" command and thus increasing performance.
I don't have a well defined question about this, but I would like to start a thread about perfection of php usage.