Page 1 of 1

Display LISE categories hierarchy position without leading zeroes

Posted: Wed Feb 14, 2024 2:27 pm
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?

Re: Display LISE categories hierarchy position without leading zeroes

Posted: Wed Feb 14, 2024 3:45 pm
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}

Re: Display LISE categories hierarchy position without leading zeroes

Posted: Thu Feb 15, 2024 9:10 am
by webform
Perfect! Thanks alot!