Purus
Purus

Reputation: 5799

Form Rendering in TWIG for FuelPHP

What's the equivalent function for this in TWIG in FuelPHP framework? I am converting a FuelPHP project from php template to TWIG template.

<?php echo render('categories/_form'); ?>

I could not see any function for this in fuel\packages\parser\classes\twig\fuel\extension.php file.

I tried the below and it says no function available as said above.

{{ render('categories/_form') }}

Is there any other method to do this?

Upvotes: 0

Views: 567

Answers (2)

WanWizard
WanWizard

Reputation: 2574

Normally you would use the Twig include tag to include sub views.

See How do you use Twig include statement with FuelPHP?

Upvotes: 1

Purus
Purus

Reputation: 5799

I manually added the form elements in the view and I get it to work.

{{ form_open({'method' : 'post','enctype' : 'multipart/form-data'}) }}
<ul>
    <li class="field">
       {{ form_label('Name', 'name') }}
       {{ form_input('name', input_post('name', ''), {'class' : 'text input'} )}}
    </li>

    <li class="field">
        {{ form_submit('submit', 'Save', {'class' : 'btn'}) }}
    </li>
</ul>
{{ form_close() }}

Upvotes: 0

Related Questions