在Smarty中获取数组第一个键值

This is my code for navigation

<ul class="sortlist">
   <li class="first"><strong>{$smarty.const.LBL_SORTBY}: </strong></li>            
   {foreach  $listsortby as $key=>$filterby}
       <li class="filterLink"><a href="javascript:void(0);" id="{$key}" class="current"  >{$filterby}</a> </li> 
   {/foreach}
</ul>

and Here I want to get the first key, and add class="current"

and rest is empty.

How to get first value and add class name for first navigation? Thanks in advance

Edited my answer after I found out a better way :)

{foreach name=listsortby from=$listsortby item=elesortby key=elesortby_key}
    <li class="filterLink"><a href="javascript:void(0);" 
    {if $smarty.foreach.listsortby.first}
        class="current"
    {/if}
    id="{$elesortby_key}">{$elesortby}</a> </li>
{/foreach}

Marcel has also noted in the comments that as of Smarty 3 you can use @first instead of my old hat implementation :)

{foreach name=listsortby from=$listsortby item=elesortby key=elesortby_key}
    <li class="filterLink"><a href="javascript:void(0);" 
    {if $elesortby@first}
        class="current"
    {/if}
    id="{$elesortby_key}">{$elesortby}</a> </li>
{/foreach}