Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Modificar el index de section

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Spanish
View previous topic :: View next topic  
Author Message
monchyrcg
Smarty n00b


Joined: 15 Apr 2013
Posts: 4

PostPosted: Mon Apr 15, 2013 9:36 am    Post subject: Modificar el index de section Reply with quote

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
View user's profile Send private message
monchyrcg
Smarty n00b


Joined: 15 Apr 2013
Posts: 4

PostPosted: Mon Apr 15, 2013 10:58 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Spanish All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP