Answer the question
In order to leave comments, you need to log in
How to get text messages from a file so as not to clutter up the Yii2 code with them?
The service has a notification system for the user, notifications are stored in the database.
But their text is written in the code, which greatly clutters it up. For example:
$this->noticeService->add(
$event->ticket->user_id,
"Ответ в тикете: " . $event->ticket->subject,
"Вам поступил ответ от поддержке в тикете: " . Html::a($event->ticket->subject, $link),
'life-ring',
'info'
);
Answer the question
In order to leave comments, you need to log in
Of course you can! What's the problem?) Do the same as in Mailer. You can at least send HTML there as in mailer. The mailer has a text template and an HTML template.
Create a php file. Insert the necessary variables into it and get the data from this file, replacing the variables.
If this option does not suit you, then you can use translations. There are no other options. And why not)
Framework tools can be stored and used in translation files Yii::t()
https://yiiframework.com.ua/ru/doc/guide/2/tutoria...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question