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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:30:19+00:00 2026-06-12T04:30:19+00:00

I have 10 html files with the names 1.html, 2.html ..etc What I want

  • 0

I have 10 html files with the names 1.html, 2.html ..etc
What I want is according to a variable, a certain file should be included in the template.

e.g.

{% if foo.paid %}
    {% include "foo/customization/{{ foo.id }}.html" %}
{% endif %}

Is this possible ? Cause the foo.id is not being translated before the includes tag works. As a result its giving a error. How can this issue be handled in a different way ?
Should I create a custom template tag for this ?

  • 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-12T04:30:21+00:00Added an answer on June 12, 2026 at 4:30 am

    You can do it with add filter and with statement .

    {% if foo.paid %}
        {% with template_name=foo.id|stringformat:"s"|add:".html" %}
            {% include "foo/customization/"|add:template_name %}
        {% endwith %}
    {% endif %}
    

    First you build a template_name, which consist of foo.id in string format concatenated with .html. Then you pass it to include tag, concatenated with path to template directory.

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

Sidebar

Related Questions

I have some html files and want to extract only lines with containing these
I have some html files that I want to convert to text. I have
I have some html files with their own css. I want to use them
I have the HTML files in assets named n0.html , n1.html , etc. I
I have like a hundred of html files with names 2.html, 4.html, 6.html, 8.html
I have a HTML file upload field from which I'm reading the file name
I have this HTML: <form action='uploadhandle.php' method='POST' enctype=multipart/form-data> <input type='file' class='fileinput' id='photo1' name='photo1'> <input
I have an HTML page that contains some filenames that i want to download
I have IIS running under Windows XP. I have .html files with classic ASP
I have multiple HTML files which vary only by a little - a few

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.