Answer the question
In order to leave comments, you need to log in
Proper storage of text with variables?
I am developing a text constructor.
The user works in a WYSIWYG analogue of Word, then saves the document. The HTML string is sent to the database and stored there. In our constructor there is such a function, something like "variables". The user can create such variables, and scatter them throughout the text. If you change a variable in one place, it changes throughout the text. What's the best way to store these things?
My option is this:
<h1>Какой то текст.</h1>
<p>Меня зовут {{3932}}.</p>
Answer the question
In order to leave comments, you need to log in
... and you get a Smarty-type bike.
Since you want to do everything yourself, then at least use the i18n mechanism of your framework. For example, for Yii2 it is www.yiiframework.com/doc-2.0/guide-tutorial-i18n.h...
It's called a "template engine" or just a template engine. There are plenty of them on the net.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question