|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
monchyrcg Smarty n00b
Joined: 15 Apr 2013 Posts: 4
|
Posted: Mon Apr 15, 2013 9:36 am Post subject: Modificar el index de section |
|
|
Quiero modificar la variable index para que en vez que empieze en cero empieze en uno
Code: | {$smarty.section.pos.index=1} | he hecho esto pero me claro me lo va mostrando en pantalla.
Lo quiero es cerrar un <ul> siempre que el index sea multiple de cuatro empezando esta variable por uno.
Code: |
<ul>
{section name=pos loop=$post }
<li>
<a href="#{$post[pos].titulo}">
{$post[pos].titulo}
</a>
</li>
{if $smarty.section.pos.index is div by 4}
</ul>
{if $smarty.section.pos.last eq false}
<ul>
{/if}
{/if}
/section}
|
|
|
Back to top |
|
monchyrcg Smarty n00b
Joined: 15 Apr 2013 Posts: 4
|
Posted: Mon Apr 15, 2013 10:58 am Post subject: |
|
|
De momento he hecho una cosa como esta,pero no me convenec
Code: |
<div class="resumen">
<ul>
{section name=pos loop=$post }
{assign var=foo value=$smarty.section.pos.index+1}
<li>
<a href="#{$post[pos].titulo}">
{$post[pos].titulo}
</a>
</li>
{if $foo is div by 4 }
</ul>
{if $foo neq 16}
<ul>
{/if}
{/if}
{if $foo eq 16}
<ul style="clear:both;"></ul>
<ul>
{/if}
{/section}
<ul style="clear:both;"></ul>
</div>
|
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|