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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:34:49+00:00 2026-06-13T14:34:49+00:00

I have a table with 9 values. I want to loop through the table

  • 0

I have a table with 9 values. I want to loop through the table and put the results into a div structure in the template.

I tried to cycle through them, but I wasn’t able to put them into different divs.

The following works to put the same value in both places. How can I increment to the next group_nm?

{% for g in groups %}

    <div class="left1">
            <a href="/group/{{ g.group_nm }}">
        <img src="/site_media/images/groups/{{ g.group_nm }}.gif" height="125px" width="200em" />
            </a>
    <p align="center">    
        <font size="5" face="Georgia, Arial" color="maroon">
            {{ g.group_nm }}
        </font>
    </p>
    </div>

    <div class="left2">
            <a href="/group/{{ g.group_nm }} ">
        <img src="/site_media/images/groups/{{ g.group_nm }}.jpg" height="125px" width="200em" />
            </a>
    <p align="center">          
        <font size="5" face="Georgia, Arial" color="maroon">
            {{ g.group_nm }}
        </font>
    </p>         
    </div>

Thanks.

EDIT: I want to do this with 9 groups (eventually, in another place, I’ll want to do it with an unlimited number). The above example only shows an example of 2 that are repeated.

  • 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-13T14:34:50+00:00Added an answer on June 13, 2026 at 2:34 pm

    Resolved it, but only if I know the number of rows that will be returned. This is will not work with unlimited numbers and isn’t as elegant as I want, but it’ll do.

    I used the ifequal forloop.counter which I found in the django google group.

    <body>
    {% for g in groups %}
        {% ifequal forloop.counter 1 %}
        <div class="left1">+
                <a href="/group/{{ g.group_nm }}">
            <img src="/site_media/images/groups/{{ g.group_nm }}.gif" height="125px" width="200em" />
                </a>
        <p align="center">    
            <font size="5" face="Georgia, Arial" color="maroon">
                {{ g.group_nm }}
            </font>
        </p>
        </div>
        {% endifequal  %}
        {% ifequal forloop.counter 2 %}  
        <div class="left2">
                <a href="/group/{{ g.group_nm }} ">
            <img src="/site_media/images/groups/{{ g.group_nm }}.jpg" height="125px" width="200em" />
                </a>
        <p align="center">          
            <font size="5" face="Georgia, Arial" color="maroon">
                {{ g.group_nm }}
            </font>
        </p>         
        </div>
    
        {% endifequal  %}
        {% ifequal forloop.counter 3 %}  
        <div class="left3">
                <a href="/group/{{ g.group_nm }} ">
           <img src="/site_media/images/groups/{{ g.group_nm }}.gif" height="125px" width="200em" />
                </a>
        <p align="center">
            <font size="5" face="Georgia, Arial" color="maroon">
                {{ g.group_nm }}
            </font>     
        </p>            
        </div>
    </div> 
    
        {% endifequal  %}
    

    and on through all 9 groups.

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

Sidebar

Related Questions

I have a list of values I want to insert into a table via
I have a table and want to get 15 values with one order and
I have the following table: I want to insert values from the MySQL workbench.
I have a HTML table as follows. I want retrieve row values from this
I have several values in a temp table called #tempIQ and I want to
I want to make an hibernate querycount on a table. I have to values,
I have 4 tables and i want to join them and extarct 4 values.
I have an array of hashes that I want to turn into a table,
I have python code below that will loop through a table and print out
I have a table in my database. I want to get the maximum value

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.