Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How to simulate the old slots of symfony1 in symfony2 inside Twig templates?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
tirengarfio  
View profile  
 More options Jul 12 2012, 10:02 am
From: tirengarfio <tirengar...@gmail.com>
Date: Thu, 12 Jul 2012 07:02:22 -0700 (PDT)
Local: Thurs, Jul 12 2012 10:02 am
Subject: How to simulate the old slots of symfony1 in symfony2 inside Twig templates?

Hi,

I just don't want to show the login form of the layout in the main login
page..

I tried to set a variable in the login child template ({% set layout_login
= false %}) and checking its value in the layout, but i needed to set also
the variable in the layout ({% set layout_login = true %}), and it always
catches the value of the variable set in the layout (true)....

And tried also setting a variable in the controller, but there isn't
anything like isset() in twig...

Any idea?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christophe COEVOET  
View profile  
 More options Jul 12 2012, 10:43 am
From: Christophe COEVOET <s...@notk.org>
Date: Thu, 12 Jul 2012 16:43:18 +0200
Local: Thurs, Jul 12 2012 10:43 am
Subject: Re: [Symfony2] How to simulate the old slots of symfony1 in symfony2 inside Twig templates?

Le 12/07/2012 16:02, tirengarfio a �crit :

> Hi,

> I just don't want to show the login form of the layout in the main
> login page..

> I tried to set a variable in the login child template (|{% set
> layout_login = false %}|) and checking its value in the layout, but i
> needed to set also the variable in the layout (|{% set layout_login =
> true %}|), and it always catches the value of the variable set in the
> layout (true)....

> And tried also setting a variable in the controller, but there isn't
> anything like |isset()| in twig...

There is:
- the defined test allows you to check if the variable is defined:
http://twig.sensiolabs.org/doc/tests/defined.html
- the default filter allows you to get a default value for undefined or
empty variables (beware that false is an empty value):
http://twig.sensiolabs.org/doc/filters/default.html

--
Christophe | Stof


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tirengarfio  
View profile  
 More options Jul 12 2012, 11:02 am
From: tirengarfio <tirengar...@gmail.com>
Date: Thu, 12 Jul 2012 08:02:35 -0700 (PDT)
Local: Thurs, Jul 12 2012 11:02 am
Subject: Re: [Symfony2] How to simulate the old slots of symfony1 in symfony2 inside Twig templates?

Thanks! My two cents :) :

    {% if layout_login is not defined %}

        {% if error %}
            <div>{{ error|trans({}, 'FOSUserBundle') }}</div>
        {% endif %}

        <form action="{{ path("fos_user_security_check") }}" method="post">
            <input type="hidden" name="_csrf_token" value="{{ csrf_token

}}" />

            <label for="username">{{ 'security.login.username'|trans({},
'FOSUserBundle') }}</label>
            <input type="text" id="username" name="_username" value="{{
last_username }}" />

            <label for="password">{{ 'security.login.password'|trans({},
'FOSUserBundle') }}</label>
            <input type="password" id="password" name="_password" />

            <input type="checkbox" id="remember_me" name="_remember_me"
value="on" />
            <label for="remember_me">{{
'security.login.remember_me'|trans({}, 'FOSUserBundle') }}</label>

            <input type="submit" id="_submit" name="_submit" value="{{
'security.login.submit'|trans({}, 'FOSUserBundle') }}" />
        </form>

    {% endif %}


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »