O
O
Optimus2018-11-26 12:48:41
Software design
Optimus, 2018-11-26 12:48:41

What are the benefits of storing templates in a database?

Some CMS store templates in a database. Sorry for the stupid question, but what is the benefit of this step? I have come across many times in WprdPress projects and in other systems, when you are looking for some string or an inscription from a template by searching the entire project in PHPStorm - it is nowhere to be found, then it turns out to be in the database.
In my opinion, this greatly complicates the work for new developers, increases the requirements for documentation. But maybe I'm wrong and just don't see the benefits...

Answer the question

In order to leave comments, you need to log in

6 answer(s)
V
Vladislav Lyskov, 2018-11-26
Pyan @marrk2

no, that's what imbeciles do

S
Sanes, 2018-11-26
@Sanes

A database cache is easier to store in RAM than a disk cache.
This refers to templates, not to any value from it. This is the default approach in Modx.

�
âš¡ Kotobotov âš¡, 2018-11-26
@angrySCV

database performance is higher than that of the file system

S
stratosmi, 2018-11-26
@stratosmi

Ease of modification programmatically.

A
Alexander, 2018-11-26
@zkelo

There is no benefit from this. Besides, it's bad to do that. A better option is to store the template as a file and link to it in the database.

P
Pretor DH, 2018-11-26
@PretorDH

When designing a CMS, everything remains a question in the STRUCTURE of the separation of the CONTENT edited by the content manager and the static TEMPLATE in which this content is placed. And the balance here is very slippery. I would say this art will come close to this balance. Yes, and the blanc itself depends on the business model, company structure, working methods and many more factors.
(Templates) One extreme is to write everything in blocks, and then the content manager will only have to do the stupid job of driving the text of pictures into blocks. But then for every "bunch" for almost every article, you will need to pull the developer that he corrected the look. This is good for projects with an hourly payment for the services of a DEV company. The developer has a lot of permanent work and the maximum paid time.
(Content) Second extreme- make a simple server assembly from the content stored in the database. And let the content manager struggle with the layout of the pages himself. Developers only minimally tweak styles on demand. The base is as simple as possible, the content is standardized in one table. Only dynamic data is pulled separately. This is ideal when the developer is paid a fixed amount, and then paid a long time for product support. Developer has maximum free time. But the customer does not understand what to pay for, he works, not programmers.
(Structure) Third extreme- when to prescribe the main templates with a bias in the modular structure. And give a free choice of customizable modules to content managers. Make each module independent, store data for it in separate tables. Make a distributed structure of servers. The structure is monstrous and there is a way to explain to the customer why there is so much code and so much time was spent. But to add non-standard features, you need to spend a lot of time for programmers and architects to build a new feature. Sometimes this time is equal to the time of writing a project from scratch. But this is an ideal option for selling such a project to investors. And then endless writing and sorting out bugs.
PS In fact, on such a small feature as the balance of structure, templates and content, the entire web development market is built. :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question