Display LISE categories hierarchy position without leading zeroes Topic is solved

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
webform
Power Poster
Power Poster
Posts: 460
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Display LISE categories hierarchy position without leading zeroes

Post by webform »

I know i can display LISE categories hierarchy position with {$category->hierarchy}, but how do i remove the leading zeroes like 00001.00016 => 1.16?
I can use |ltrim:'0' on the first part but what about the second part after the decimal point?
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1629
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Display LISE categories hierarchy position without leading zeroes

Post by DIGI3 »

I don't know if this is the most efficient way, but it's an option:

Code: Select all

{$parts=explode('.', $category->hierarchy)}
{$parts[0]|ltrim:0}.{$parts[1]|ltrim:0}
Not getting the answer you need? CMSMS support options
webform
Power Poster
Power Poster
Posts: 460
Joined: Sat Nov 25, 2006 3:39 pm
Location: Copenhagen, Denmark

Re: Display LISE categories hierarchy position without leading zeroes

Post by webform »

Perfect! Thanks alot!
Post Reply

Return to “Modules/Add-Ons”