> For the complete documentation index, see [llms.txt](https://docs.toomuchmedia.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.toomuchmedia.com/using-nats/one-off-articles/smarty/available-smarty-functions.md).

# Available Smarty Functions

*Article Topics:* [*Smarty*](/getting-started/common-topics/smarty.md)

## Available Built-in Smarty Functions:

* count
* strtolower
* strtoupper
* number\_format
* date\_format
* array
* list
* isset
* empty
* sizeof
* in\_array
* is\_array
* is\_numeric
* true
* false
* strlen
* strpos
* nl2br
* array\_key\_exists

## Available TMM Smarty Modifiers:

* dhms : Used to get the days:hours:minutes:seconds from seconds

```
{assign var=b value='1234567890'}
{$b|dhms} // returns: 14288d 23h 31m 30s 
```

* tmm\_abbreviate : Used to abbreviate a string

```
{assign var=c value='as soon as possible'}
{$c|tmm_abbreviate} // returns: asap
```

* maxlength : Used to restrict a string to the max length

```
{assign var=d value='The quick brown fox jumps over the lazy dog'}
{$d|maxlength:10} // returns: The quick bro... 
```

* ucwords : Used to convert the first character of each word in a string to uppercase

```
{assign var=f value='The quick brown fox jumps over the lazy dog'}
{$f|ucwords} // returns: The Quick Brown Fox Jumps Over The Lazy Dog
```

* currency\_format : used to display a number in its proper currency format

```
{assign var=g value='12345'}
{$g|currency_format} // returns: $12,345.00
```

* currency\_format\_cents : Used to display a number in its proper currency format where currency is in cents

```
{assign var=g value='12345'}
{$h|currency_format_cents} // returns: $123.45
```

* math\_opposite : Used to change the sign for a number

```
{assign var=h value='12345'}
{$h|math_opposite} // returns: -12345
```

* bytes : Used to format a number of bytes into a readable number

```
{assign var=j value='12345'}
{$j|bytes} // returns: 12.06 Kb 
```

* long2ip : Used to convert a long integer address into a string in (IPv4) Internet standard dotted format

```
{assign var=k value="2071690107"}
{$k|long2ip} // returns: 123.123.123.123
```

* convlang : Used to take in a string and find the valid language version

{% code overflow="wrap" %}

```
{assign var=l value="description"}
{$l|convlang} // returns: Beschreibung where "decription" exists in the language file
```

{% endcode %}

* tmm\_strpos : Used to return the position of the first occurrence of a string inside another string

```
{assign var="m" value="https://google.com/search/this/site"}
{$m|tmm_strpos:'/'} // returns: 5
or reverse
{$m|tmm_strpos:'/':1} // returns: 29
```

* tmm\_strstr : Used to get the first occurrence of a string inside another string

```
{assign var="n" value="https://google.com/search/this/site"}
{$n|tmm_strstr:'search'} // returns: search/this/site
or inverse
{$n|tmm_strstr:'search':1} // returns: https://google.com/
```

* tmm\_substr : Used to cut a part of a string from a string, starting at a specified position.

```
{assign var="a" value="abc@123.com"}
{$a|tmm_substr:0:6} // returns: abc@12
or inverse
{$a|tmm_substr:-4:4} // returns: .com
```

* rand : Used to get a random number with a min and max limit
