Answer the question
In order to leave comments, you need to log in
Yii2 how to display the form in the right content from the base?
Good day colleagues.
I am new to Yii2 and have a small problem with the task at hand. Ask for help from knowledgeable people.
The essence of the problem.
Some content (html layout) is stored in the database. How do you understand the data gets on the page. And everything would be fine, but on some pages you need to display a feedback form. And here I have a stupor.
Displaying the form in the view itself using the widget is no problem. But I can not tie it to the content from the database.
The idea was as follows:
1) In the content, we define a certain line to insert the form there (some kind of shortcode for Wordpress) ###myForm###
2) When generating the page, we look for this marker using a regular expression to insert the form.
3) The form itself is in a separate file _myform.php , the form is made using the ActiveForm() widget .
And then I don't know what to do. How to pass this form to the view. (Maybe you need to use ob_start() for buffering )
Although I think Yii2 should have solutions for such a task out of the box.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question