1

Want to display entry_id's in a numeric list so they can be sorted with jquery plugins.

Heres current code to achieve this, basically adding appropriate amount of zeros before entry_id so all are 5 digits:

 Entry ID {if entry_id < '10'}0000{/if}{if entry_id < '100'}000{/if}{if entry_id < '1000'}00{/if}{if entry_id < '10000'}0{/if}{entry_id}

There has to be a cleaner way!?

2

You can use CE String native method of str_pad to pad the {entry_id} to a certain length:

{exp:ce_str:ing str_pad="5|0|:CONST:STR_PAD_LEFT"}{entry_id}{/exp:ce_str:ing}
1
  • No problem, remember to mark this answer as correct
    – Siebird
    May 3 '13 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.