Just after Godoy's reply I noticed the detail of you having only 10 flags...

If that is true, you can use Godoy's code... if you can have more than
10 flags and want a <br> just after every 5 flags, my code will do the
trick...


Cheers,

Roger



On 4/24/07, Roger Demetrescu <[EMAIL PROTECTED]> wrote:
> Try something like:
>
>
> <span py:for="i,f in enumerate(flags)">
>
>     <img src="${f.path}"/>
>
>     <br py:if="not (i+1)%5" />
>
> </span>
>
>
>
> On 4/23/07, CircleOfThirteen <[EMAIL PROTECTED]> wrote:
> >
> > Hi. Hopefully someone can help me, I'm pretty new to this.
> >
> > I have a table in my database that contains paths to pictures of
> > flags. I have 10 flags and the pictures all have the same dimensions.
> > This is how my controller.py and .kid file look:
> >
> > #controller.py
> >      f = Flags.select()
> >      return dict(flags = f)
> >
> > #ShowFlags.kid
> >      <span py:for="f in flags">
> >           <img src="${f.path}"/>
> >      </span>
> >
> > It works fine, on my screen it actually displays 6 flags on the first
> > row and 4 flags on the second. My question though is, what if I wanted
> > to control how many flags there are in a single row? In other words,
> > let's say I want to display only 5 flags and then issue a "<br/>"
> > statement, how could I do that?
> >
> > My initial thought was just use some sort of counter like:
> >
> >      x = 0
> >
> >      <span py:for="f in flags">
> >           <img src="${f.path}"/>
> >
> >           x = x + 1
> >
> >           if x == 5:
> >                x = 0
> >                <br/>
> >      </span>
> >
> > Obviously that code will not work, but something along those lines.
> > Can someone please help me?
> >
> >
> > > >
> >
>

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

Reply via email to