Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7855029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:15:38+00:00 2026-06-02T20:15:38+00:00

Im using Symfony and Twig in a Silex application. I have a registration page

  • 0

Im using Symfony and Twig in a Silex application.

I have a registration page with a form in:

{% extends "base.twig" %}

{% block title %}Welcome to My Example site{% endblock %}
{% block head %}
{{ parent() }}
{% endblock %}
{% block content %}

<div class="row">
<div class="span12">
    <h2>Register</h2>
    <p>
        Register for this site and we'll give you free access to cool stuff
        in addition you can subscribe to our premium content.
    </p>
   
    <form  action="{{app.config.site.secureUrl}}/register-handler" method="post">
        <fieldset >
            {{ form_widget(form) }}
            <button type="submit" class="btn btn-info">Send</button>
        </fieldset>
    </form>
</div>
</div>

</div>

{% endblock %}

I get the following error when trying to render the page:

Twig_Error_Syntax: The filter "trans" does not exist in "form_div_layout.html.twig" at line 35

I’ve narrowed this down to the Symfony translation extension not being installed and as such the default template located in:

vendor\symfony\twigbridge\Symfony\Bridge\Twig\Resources\views\Form\form_div_layout.html.twig

does not render correctly.

I’ve made a new template based on the one above without the translation functions in.

Question

how do I get twig to use the new template instead of the default one?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T20:15:39+00:00Added an answer on June 2, 2026 at 8:15 pm

    If you want to use your own template for form, you just have to specify it in the options when you register Twig :

    $app->register(new Silex\Provider\TwigServiceProvider(), array(
          'twig.path' => __DIR__ . '/[Path_to_views_directory]',
          'twig.class_path' => __DIR__ . '/vendor/twig/lib',
          'twig.form.templates'   => array([path_to_your_overriden_template]),
     )) ;
    

    see the documentation : TwigProvider documentation

    But I think it is better to use the original template and register the translation provider like this :

    $app->register(new Silex\Provider\TranslationServiceProvider(), array(
          'locale' => '[Your_locale]',
          'translation.class_path' =>  __DIR__ . '/../vendor/symfony/src',
          'translator.messages' => array()
    )) ;
    

    And if you use validation don’t forget to read this cookbook :

    Translation cookbook

    Hope this will help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using symfony with doctrine and I make a registration form. Email field is
Normally, we can have the Symfony Form to output the field errors using the
Using symfony 1.4. I have the following widget declaration in my form: 'region' =>
I am using Symfony 1.4 and Propel as ORM. I have created a form
Using Symfony 1.3 I have a normal form-filter that is used to filter values
N00b question: I'm using Symfony with Doctrine. I have a form where I've added
NB: i´m using Twig in a non-Symfony context. I want to register a master
I am developing an application using symfony2 and twig for templates. The problem comes
we using symfony 1.0. We have an module work with Propel objects. The sql-querys
I'm using Symfony 1.4. I'm posting a form via Jquery ajax to an action

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.