DragonByte Tech
Well-known member
(This could potentially also work as an optional parameter to the existing "number" filter.)
Currently, if you want the absolute number in a template, you have to do silliness like this:
	
	
	
		
Therefore I would like to request being able to pipe the variable to an "abs" filter that just runs PHP's 
Use case: Let's say that I am looping through transactions, and I want to display a "pretty" phrase, e.g. "Earned X points" or "Spent Y points". Currently, it would say "Spent -1 points" because the transaction amount is a signed value in the database, unless I do that
Fillip
				
			Currently, if you want the absolute number in a template, you have to do silliness like this:
		HTML:
	
	<xf:set var="$amount" value="{{ $transaction.amount < 0 ? ($transaction.amount * -1) : $transaction.amount }}" />abs().Use case: Let's say that I am looping through transactions, and I want to display a "pretty" phrase, e.g. "Earned X points" or "Spent Y points". Currently, it would say "Spent -1 points" because the transaction amount is a signed value in the database, unless I do that
<xf:set /> as above.Fillip
		
		Upvote
		1
		
	
			 
 
		 
 
		