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 7982979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:49:40+00:00 2026-06-04T10:49:40+00:00

I am developing an application using Symfony2. I am using Twig for templating an

  • 0

I am developing an application using Symfony2. I am using Twig for templating an a 3 level interface architecture. In my application there are 3 kind of users, anonimous users, udentified users and Administrators. The Page is divided in sections this way:

<!-- app/Resources/views/base.html.twig -->
<!DOCTYPE html>

<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />

        <title>{% block title %}Anotatzailea{% endblock %} - Anotatzailea</title>
            <!--[if lt IE 9]>
                    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
            <![endif]-->

            {% block stylesheets %}
        <link href='http://fonts.googleapis.com/css?family=Voces' rel='stylesheet' type='text/css'>
                <link href='http://fonts.googleapis.com/css?family=La+Belle+Aurore' rel='stylesheet' type='text/css'>
                <link href="{{ asset('css/screen.css') }}" type="text/css" rel="stylesheet" />
            {% endblock %}

            <link rel="shortcut icon" href="{{ asset('favicon.ico') }}" />
        </head>

    <body>
    <section id="wrapper">
                <header id="header">

                <div id="logo">
                    <text>Anotatzailea</text>
                </div>
                        <div class="top">
                                 {% block navigation %}
                     {# Ikusi behar da ea erabiltzailea kautotu den, horren arabera aukera desberdinak erakusteko #}
                        {% if is_granted('ROLE_USER') %}
                                    <nav>
                                        <ul class="navigation">
            <li class="first current_page_item"><a href="{{ path('AnotatzaileaAnotatzaileaBundle_homepage') }}">Hasiera</a></li>
                    <li><a href="{{ path('AnotatzaileaAnotatzaileaBundle_informazioa') }}">Argibideak</a></li>
            <li><a href="{{ path('AnotatzaileaAnotatzaileaBundle_nirekontua') }}">Kontua</a></li>
            <li><a href="">Estatistikak</a></li>
            <li><a href="{{ path('AnotatzaileaAnotatzaileaBundle_testuaanotatu') }}">Anotatu</a></li>
            <li><a href="{{ path('AnotatzaileaAnotatzaileaBundle_FAQ') }}">FAQ</a></li>
            <li><a href="{{ path('AnotatzaileaAnotatzaileaBundle_kontaktatu') }}">Kontaktatu</a></li>
            <li class="last"><a href="{{ path('saioa_amaitu') }}">Irten</a></li>
                                        </ul>           
                                    </nav>
                    {% elseif is_granted('ROLE_ADMIN')%}
                        <nav>
                                        <ul class="navigation">
            <li class="first current_page_item"><a href="{{ path('AnotatzaileaAnotatzaileaBundle_homepage') }}">Hasiera</a></li>
            <li><a href="{{ path('AnotatzaileaAnotatzaileaBundle_informazioa') }}">Argibideak</a></li>
            <li><a href="{{ path('AnotatzaileaAnotatzaileaBundle_nirekontua') }}">Kontua</a></li>
            <li><a href="{{ path('AnotatzaileaAnotatzaileaBundle_dokumentuak') }}">Dokumentuak</a></li>
            <li><a href="">Erabiltzaileak</a></li>
            <li><a href="">Estatistikak</a></li>
            <li class="last"><a href="{{ path('saioa_amaitu') }}">Irten</a></li>
                        </ul>           
                                    </nav>
                    {% else %}
                        <nav>
                                        <ul class="navigation">
            <li class="first current_page_item"><a href="{{ path('AnotatzaileaAnotatzaileaBundle_homepage') }}">Hasiera</a></li>
                    <li><a href="{{ path('AnotatzaileaAnotatzaileaBundle_informazioa') }}">Argibideak</a></li>
            <li><a href="{{ path('AnotatzaileaAnotatzaileaBundle_saioahasi') }}">Sartu</a></li>
            <li><a href="{{ path('AnotatzaileaAnotatzaileaBundle_erregistratu') }}">Erregistratu</a></li>
            <li><a href="{{ path('AnotatzaileaAnotatzaileaBundle_FAQ') }}">FAQ</a></li>
            <li class="last"><a href="{{ path('AnotatzaileaAnotatzaileaBundle_kontaktatu') }}">Kontaktatu</a></li>
                                        </ul>           
                                    </nav>
                    {% endif %}                 
                                {% endblock %}
                        </div>
        </header>
        <section id="page">
                    <section class="main-col">
                        {% block body %}{% endblock %}
                </section>
                         {% if is_granted('ROLE_USER') or is_granted('ROLE_ADMIN') %}
                    <section class="sidebar">
                        {% block sidebar %}{% endblock %}
                    </section>
                         {% endif %}
            <div id="footer">
                        {% block footer %}
                <!-- Partekatu -->
                <div class="addthis_toolbox addthis_default_style addthis_32x32_style">
                    <a class="addthis_button_preferred_1"></a>
                    <a class="addthis_button_preferred_2"></a>
                    <a class="addthis_button_preferred_3"></a>
                    <a class="addthis_button_preferred_4"></a>
                    <a class="addthis_button_compact"></a>
                    <a class="addthis_counter addthis_bubble_style"></a>
                </div>
        <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4f4e593d146466e9"></script>
                <!--------------->
                <script type="text/javascript">
                        var addthis_config = {
                        ui_language : "[eu]"   
                        }
                </script>
                                 Testua anotatzeko tresna - created by H.Salaberri</a>
                        {% endblock %}
                    </div>


            </section>

    </section>

            {% block javascripts %}


        {% endblock %}
        </body>
</html>

What I would like to do is to show the sidebar just when the identified users are logged in the application. The way I do it I just achieve not show the sidebar for anonymous users. The other problem is I don’t know how to make the main-col section bigger so that the gap left by the sidebar can not be seen.

  • 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-04T10:49:42+00:00Added an answer on June 4, 2026 at 10:49 am

    I think you can get what you need to,easily by applying the condictions as

       {% if is_granted('ROLE_USER') or is_granted('ROLE_ADMIN') %}
                          <section class="main-col">
         {%else%} 
                          <section class="main-col">
                         {# modify the class of this section as your requirement #}
         {%endif%}
    
                                {% block body %}{% endblock %}
                          </section>
    {% if is_granted('ROLE_USER') or is_granted('ROLE_ADMIN') %}
                          <section class="sidebar">
                                {% block sidebar %}{% endblock %}
                          </section>
    {%endif%}
    

    hope this helps

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

Sidebar

Related Questions

I am developing an application using symfony2 and twig for templates. The problem comes
I am developing an application using Symfony 2 and Twig for templating. I would
When developing an application using agile techniques, what if any initial modelling/architecture activities do
I am developing an application using Symfony2. The problem comes when creating a registration
I am developing an application using symfony2 and using orm.yml files for mapping the
I am developing an application using which users can update their twitter status. Then
I am developing Desktop application using c#.net and MySql. Is there any solution to
I am developing an application using Asp.Net.My question is whether there is any solution
I am developing an application using Symfony2 and Jquery as a JavaScript FW. I
I am developing an application using Symfony2 and DQL for building some queries in

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.