0

I have this code

{foreach from=$last_user item=s}
  <span class="sp_1">{$s.username}</span>
{/foreach}  

I want only show three first letter of {$.username} .

If i need JavaScript or jQuery please write full code.

Pedram
  • 14,199
  • 8
  • 38
  • 69

1 Answers1

0

you just have to use substring(startingFromIndex, endingIndex)

{foreach from=$last_user item=s}
    <span class="sp_1">{$s.username.substring(0, 3)}</span>
{/foreach}

Here is a reference for a similar question

Ayyub Kolsawala
  • 739
  • 7
  • 12