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

  • Home
  • SEARCH
  • 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 9254675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:31:54+00:00 2026-06-18T11:31:54+00:00

First, let me start with the code I’m attempting to use: {% if modal

  • 0

First, let me start with the code I’m attempting to use:

{% if modal == true %}
    {% block header %}{% endblock %}
    {% block footer %}{% endblock %}
{% endif %}

What I’m trying to accomplish is to not show my header and footer blocks ONLY if the variable called modal is true. I also have this below the if statement:

{% block content %}
    {{ dump(modal) }}
{% endblock %}

What happens here is that my override for emptying the header and footer blocks always runs regardless of if the value of modal is true or otherwise. So, I run this with modal passed in as false and the result is that the header and footer still don’t show. The output of the dump command accurately shows true or false, but the condition always seems to evaluate to true in the if statement.

Can blocks not be wrapped in a conditional statement, or is there something additional I need to do to make this work?

  • 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-18T11:31:55+00:00Added an answer on June 18, 2026 at 11:31 am

    Blocks don’t care about any logic around it, as said in the documentation:

    A block provides a way to change how a certain part of a template is rendered but it does not interfere in any way with the logic around it.

    You should put that logic inside the block, not on the outerside, as you can see on the last example in that article.

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

Sidebar

Related Questions

my first question on Stackoverflow. Let me start with a bit of code. It's
Hi all first post here :) Let's start with a snippet of the code
Let's first start with a code snippet to explain the issue: = Haml::Engine.new('#bar= yield').render
Let me first start off, sorry for the confusing title. I didn't know how
First off, let me start by saying that I am totally new to working
First let me say that I know it's better to use the subprocess module,
First let me start by saying that I don't have a complete understanding of
First off let me start by saying I am using CodeIgniter and the Facebook
Let me start by the end and the actual question: I'm trying to write
Let me illustrate this question with code first: with Ada.Text_IO; procedure Test is task

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.