# BaseTemplate

> Provides reusable token substitution for template strings.

[API reference](/docs/api/index.md) › [HTML Helper](/docs/extensions/html-helper/reference/index.md) › [Base](/docs/extensions/html-helper/reference/base/index.md) › BaseTemplate

| abstract class | `UIAwesome\Html\Helper\Base\BaseTemplate` |
| --- | --- |
| Source | [`src/Base/BaseTemplate.php`](https://github.com/ui-awesome/html-helper/blob/main/src/Base/BaseTemplate.php#L15) |

1 subclass:

- [`UIAwesome\Html\Helper\Template`](/docs/extensions/html-helper/reference/template/index.md)

Provides reusable token substitution for template strings.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`render()`](#method-render) static | Renders a template string by substituting tokens with provided values. | `BaseTemplate` |

## Method details

### render() <span id="method-render"></span>

```php
public static function render(string $template, mixed[] $tokenValues): string
```

Renders a template string by substituting tokens with provided values.

Converts literal `\n` sequences to line breaks and removes empty lines after substitution.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$template` | `string` | Template string containing tokens to be replaced. |
| `$tokenValues` | `mixed[]` | Associative array of token replacements. |

**Returns**

`string`: Rendered template string with substituted values.