O repeat tem uma série de variáveis que podem auxiliá-lo a obter o resultado esperado: São elas:
* index - número da repetição, iniciando por zero. * number - número da repetição, iniciando por um. * even - true for even-indexed repetitions (0, 2, 4, ...). * odd - true para índices de repetições ímpares (1, 3, 5, ...). * start - true para o início da repetição (indice 0). * end - true para o final da repetição * length - tamanho da sequência, equivalente ao número total de repetições. * letter - conta repetições com letras minúsculas: "a" - "z", "aa" - "az", "ba" - "bz", ..., "za" - "zz", "aaa" - "aaz", e por aí vai. * Letter - versão maiúscula de letter. Zénrique. Em 18/04/07, Joao Paulo Carusi <[EMAIL PROTECTED]> escreveu:
ah vc pode usar odd e even (par e impar) ajuda? On 4/18/07, Joao Paulo Carusi <[EMAIL PROTECTED]> wrote: > > Opa Rafael, > > eu sinceramente so sei fazer condicoes para o primeiro (start) e ultimo > (end)... > > Abracos, > JP > > > On 4/18/07, Rafael Rocha <[EMAIL PROTECTED] > wrote: > > > > Obrigado pela dica João. > > Mas e seu eu quiser regras diferentes para o segundo e para o terceiro > > por exemplo, como faria? Não tem como ter um iterator marcado por um indice? > > []s > > Rafael > > > > Em 18/04/07, Joao Paulo Carusi <[EMAIL PROTECTED] > escreveu: > > > > > > > > > > > > <div tal:define="is_first repeat/obj/start"> > > > <div tal:condition="is_first"> > > > Primeiro > > > </div> > > > <div tal:condition="not:is_first"> > > > outros > > > </div> > > > </div> > > > > > > > > > On 4/18/07, rcr_plone < [EMAIL PROTECTED] > wrote: > > > > > > > > Pessoal, > > > > Estou usando o Publicator para trazer cinco noticias em meu site. > > > > Porem, não quero que as cinco noticias tenham o mesmo tratamento. > > > > De > > > > algumas eu vou querer colocar o título, de outras o título e a > > > > descrição. Minha dúvida é como fazer uma iteração que percorra os > > > > items que o publicator me traz com um indice. Achei que isso seria > > > > facil, mas ainda nao consegui implementar. Já tentei de muitas > > > > formas, > > > > achei que o natural seria: > > > > <div tal:omit-tag="" tal:define="box_items python:pb['items[0]']"> > > > > Para acessar a primeira noticia... Mas não funcionou. Alguem tem > > > > alguma luz sobre como devo fazer. > > > > > > > > Muito obrigado, > > > > Rafael > > > > > > > > <html metal:use-macro="here/main_template/macros/master"> > > > > > > > > <body metal:fill-slot="main"> > > > > > > > > <div tal:omit-tag="" tal:define="box_id string:inicial; > > > > portal_publicator > > > > nocall:here/portal_publicator; > > > > pb > > > > python:portal_publicator.getPublicationBoxesInfo(box_id); > > > > isVisible pb/visible;" > > > > tal:condition="python:template.getId()!='parceiro' and isVisible"> > > > > > > > > <span tal:content="pb" /> > > > > <div tal:omit-tag="" tal:define="box_items python:pb['items']"> > > > > > > > > <tal: repeat="obj python:box_items"> > > > > > > > > <div tal:define="oddrow repeat/obj/odd; > > > > item_id obj/Id; > > > > identificador obj/Identifier; > > > > item_title obj/Title; > > > > aqui obj/RelativeURL; > > > > item_url obj/RelativeContentURL; > > > > new_window obj/NewWindow; > > > > item_icon obj/Icon; > > > > item_modified obj/ModificationDate; > > > > item_description obj/Description; > > > > item_date obj/CreationDate;" > > > > tal:condition="python:item_url"> > > > > <span tal:define="global dateFor obj/CreationDate" /> > > > > > > > > <div class="newsTitle"> > > > > <a href="" > > > > tal:attributes="href aqui; > > > > target python:test(new_window, > > > > '_blank', None);" style="font-family: Verdana; font-size: 100%;"> > > > > <img tal:attributes="src item_url"><br /> > > > > <span tal:content="item_title" /> > > > > </a><br /><br /> > > > > > > > > </div> > > > > > > > > <div class="newsImageContainer" > > > > tal:condition="python:aqui +'/image_mini'"> > > > > <a href="#" > > > > tal:attributes="href > > > > string:$item_url/image/image_view_fullscreen"> > > > > <img tal:attributes="src python:aqui + '/image_mini'"> > > > > </a> > > > > > > > > </div> > > > > > > > > </div> > > > > > > > > </tal:> > > > > </div> > > > > </div> > > > > > > > > </body> > > > > </html> > > > > > > > > > > > > > >