Hello,

Current template system in bugs.php.net code is integrated in front
controllers (index.php...) and some separate template files. It
contains several helper functions with globals usage and mixes HTML
with PHP code logic. This makes app code a bit disorganized and less
testable.

I'd suggest to refactor this issue into a:
- separate template engine
- templates folder
- front controllers (PHP files currently residing in the www directory
- index.php...)

The template layer for the bugs.php.net is in progress happening here:
https://github.com/php/web-bugs/pull/66

This introduces two additional classes (so far):
- App\Template (main template engine with render method)
- App\Template\Context (to be able to use $this in the template directly)
- phpunit tests attached
- a quick intro how to use such template layer

Pros:
- still thin and simple enough to understand it quickly (very little
methods used)
- no additional caching required (performance impact is still being measured)
- integrated in the app directly so no dependencies required to
install in this aspect

I didn't want to introduce a 3rd party template engine here because
the app can't use composer installation step when deploying to
production yet neither we might agree on using some piece of template
engine. This patch is still in progress so I just wanted to get some
feedback and opinions at this phase.

Any thoughts?

Thank you.
-- 
Peter Kokot

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

Reply via email to