A
A
Alexander Ivanov2017-05-24 18:11:59
PHP
Alexander Ivanov, 2017-05-24 18:11:59

How to create contact forms on phalcon(component)?

Recently, the question was asked why they don’t choose phalcon, now I understand why. I look at the documentation and understand that I don’t understand anything in it, I mastered this material with yii2 in a week.
The only more complete course on phalcon on youtube that I had in unbearable Chinese)
Trying to make a feedback form that I can connect to different views, such as component, widget or snippet (everywhere is called differently).

//volt
                {{ form('send', 'method': 'post', 'role': 'form') }}
                  {{ text_field("name", "placeholder": "Ваше Имя", "class":"forms__inp") }}
                  {{ tel_field("tel", "placeholder": "Телефон", "class":"forms__inp tell") }}
                  {{ submit_button('Отправить', "class":"btn btn-red forms__inp") }}
                {{ end_form() }}

Of course, I can shove post.php into public, but then Bitrix will work and ajax will be screwed.
Where can I see some more understandable example using phalcon?
______________
On yii2 it looked like this:
/component/
../views/formWidget.php
../formWidget.php
//вывел
<?= ContactWidget::widget([]) ?>

The template engine was not included. Also could connect the given piece in any representation. I would like to do a similar thing on phalcon.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jasonOk, 2017-05-24
@cimonlebedev

I still can't understand what is your problem?
You can separate your piece of code into a separate view, and then just do

{% Include('shared/form_view') %} 
//или
{{ partial('shared/form_view') }}

PS. the first option is preferable, but in the second one you can pass "parameters", for example,
{{ partial('shared/form_view', ['show_submit':true]) }}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question