-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minimalistic templating engine for PHP #33279
base: develop
Are you sure you want to change the base?
Conversation
@frederic34 @eldy je le fais en français pour être bien compris... Laurent ! tu as toujours été contre des librairies externes sauf si on n'avait pas le choix... est-ce que ceci rentre dans "pas le choix" ? car des propositions de tpl html j'en avais fait des tonnes qui ont toujours été refusées ! Et qui ne dépendaient pas de librairies externes ! |
@eldy est-ce que je me suis au fil du temps décridibilsé de part mes conneries ? Est-ce qu'il faut toujours ton aval pour confirmer mes propos ? |
As you can see, external library is very light |
@frederic34 yes ... and 2018 is the last modification of this libraries ? |
@frederic34 in the past we experiment a html presentation template engine that was called Smarty (very light too) but the feedback proves it was not a so good idea. |
The point of using PHP as the templating engine is ok and great too, but maybe some more convention can be added in the design documents about what's allowed and what is not. Currently, we only have this single guideline in this document:
Which is a bit sparse to be able to guide the developers in my opinion. Among the questions, there's no clear convention for how to expose standard tools that makes the templating engine interesting, and in particular conditions, blocks, blocks extensions, and inclusions with parameters, so it's effectively not documented how to have "components" instead of pages. It's possible to generate the components with ob_start()/ob_get_clean() (https://www.php.net/manual/en/function.ob-start.php), and it's also possible to generate the components with heredoc syntax (https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc). It's also possible to use echo and directly print to the output stream. From what I've seen in dolibarr (which might not be exhaustive), there are already multiple usages and ways it's done:
But some thoughts are missing for the usual code quality helpers: error handling when variables are not defined, linter indications to have warnings if some templates are missing some contexts to ease changes in templates, composability in general with clear definition of what can be hooked or not, and where it is selected from, tooling for designers so that they can render a template/component with a pre-defined configuration without running a full dolibarr instance and more standardization of the process to add more blocks that can be overriden. In short, I also think an additional templating engine is not necessary, but the process is still not frozen and documented enough to answer the how-to, since using PHP as templating engine gives way more freedom than using a templating engine. |
Yes, guidelines are very poor for the moment. In first Dolibarr versions, there was no guideline at all. We should add more now product isbdevelopped byva high number of different developers. We/You may open/create 1 issue for each guideline you suggest. |
No description provided.