Lee Hinde wrote:
> 
> 
> On Sun, Sep 14, 2008 at 10:00 PM, sotirac <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
> 
> 
>     In the django template where I am using a for loop, I have to use a
>     special tag (div class="yui-u first" instead of div class="yui") for
>     every forth item.  Im trying to create a table with three columns.  I
>     can access the first loop but how do I do it for every third.
>     --------------
>     <pre>
>     {% extends "base.html" %}
> 
>     {% block content %}
>            {% for website in websites %}
>            {% if forloop.first %}
>            <div class="yui-u first">
>            {% else %}
>            <div class="yui-u">
>            {% endif %}
[...]
> Check the template tags. I think divisibleby might work for you.
> 
An easy way to implement this feature is the "cycle" tag.

>            {% if forloop.first %}
>            <div class="yui-u first">
>            {% else %}
>            <div class="yui-u">
>            {% endif %}

would then become

<div class="{% cycle "yui-u first", "yui-u", "yui-u", "yui-u" %}">

However I'm not really able to understand the rest of your logic enough
to determine how the remainder of the code would change, because I'm not
sure I understand it well enough.

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to