Seite 1 von 1

Variable i+

Verfasst: Donnerstag 14. Juni 2007, 11:56
von mgraf
Hallo,
bin neu in diesem Forum und das Zope/Plone Abteilung liest sich für mich sehr interessant.

Und da ich gerade ein Problem habe... ;-)

Naja, zum Problem: ich will das er mir eine Zahl immer erhoeht bis am Ende:

Code: Alles auswählen

<div metal:define-macro="thumbnails"
       tal:define="result python:here.atctListAlbum(images=1, folders=1, subimages=0, others=1);
                   images result/images;
                   albums result/folders;
                   gallery python: here.makeGallery(images, 6);
                   otherContents result/others
                   rel python: len(images)"">

  <tal:zloop tal:repeat="zeile gallery">
    <tal:vars tal:define="zeilenindex repeat/zeile/index">
    <ul>
    <tal:sloop tal:repeat="image python:gallery[zeilenindex]">
	  <li class="item"><div id="" tal:attributes="id python:range(0,rel)"><a href=""></a></div></li>
	</tal:sloop>
    </ul>
    </tal:vars>
  </tal:zloop>
</div>

</div>
und ich will das er mir die
<li><DIV ID="slot_XX"></div></li>
immer erhht bis eben am Ende,
aber ich hab keine Ahung wie... :oops:

Hoffe jemand kann mir helfen...

PS: ich habs schon mit range(rel) versucht, aber da beginnt er schon bei 0, und dann fehlt mir am Ende natürlich eines

Verfasst: Donnerstag 14. Juni 2007, 12:43
von birkenfeld
range(1, rel+1) ?

Re: Variable i+

Verfasst: Donnerstag 14. Juni 2007, 12:46
von gerold
mgraf hat geschrieben:Naja, zum Problem: ich will das er mir eine Zahl immer erhoeht bis am Ende:
Hallo mgraf!

Willkommen im Python-Forum!

Warum verwendest du nicht den gleichen Trick wie oben noch einmal?

Code: Alles auswählen

tal:attributes="id repeat/image/index"
Und "number" beginnt bei 1:

Code: Alles auswählen

tal:attributes="id repeat/image/number"
Siehe: http://www.zope.org/Documentation/Books ... T.stx#2-39

mfg
Gerold
:-)

Verfasst: Donnerstag 14. Juni 2007, 13:21
von mgraf
@gerold Danke
das dachte ich auch, aber ich hab vorher die tal:zloop und tal:sloop schleife drinnen

Mit
tal:attributes="id repeat/image/number"

tut er so:

Code: Alles auswählen

<ul id="zeile_1">
<li class="bild_1">Bild A></li>
<li class="bild_2">Bild B></li>
<li class="bild_3">Bild C></li>
</ul>
<ul id="zeile_2">
<li id="bild_1">Bild D></li>
<li id="bild_2">Bild E></li>
<li id="bild_3">Bild F></li>
</ul>
ich brauchs aber so:

Code: Alles auswählen

<ul id="zeile_1">
<li class="bild_1">Bild A></li>
<li class="bild_2">Bild B></li>
<li class="bild_3">Bild C></li>
</ul>
<ul id="zeile_2">
<li id="bild_4">Bild D></li>
<li id="bild_5">Bild E></li>
<li id="bild_6">Bild F></li>
</ul>