views:

430

answers:

1
    Here is the Sample Code:
      {section name="firstlevel" loop=$xxx}
        <ul>
            {section name="secondlevel" loop=$xxx[firstlevel]}
               <li>$xxx[firstlevel][secondlevel].values</li>
            {/section}
        </ul>
      {sectionelse}
          No values
      {/section}
      {if $smarty.section.firstlevel.last}
         {include file="pagination.tpl"}
      {/if}

I have limited 10 records per page, but this smarty code not calling the include file pagination. Please suggest what wrong in it or give idea...
A: 

I'm not a Smarty guru but I believe "last" only returns true while in the section. This would probably be preferable anyway as there is little or no use showing pagination when there are no records.

  {section name=firstlevel loop=$xxx}
    <ul>
        {section name=secondlevel loop=$xxx[firstlevel]}
           <li>$xxx[firstlevel][secondlevel].values</li>
        {/section}
    </ul>
    {if $smarty.section.firstlevel.last}
       {include file="pagination.tpl"}
    {/if}
  {sectionelse}
      No values
  {/section}
enbuyukfener
Thanks, but its not working ....
boss
Can you explain what it is that is not working? I decided to try it out and it is working for me. Try add some text in the `{if $smarty.section.firstlevel.last}` section to ensure that conditional is working, and then ensure pagination.tpl outputs something.
enbuyukfener
U can see in the section {section name=firstlevel loop=$xxx}
boss
You can see the pagination at the end of the section? If so, isn't that what you want?
enbuyukfener