Finch Template Events Guide

In addition Jinja events and your custom events, Finch provides a set of built-in events that you can use in your templates. These events are useful for adding dynamic behavior to your templates.

some examples of built-in events:

{{ isLocalDebug }} : show if is local debug or production mode
{{ assets.js() }} : show all js files
{{ assets.css() }} : show all css files
{{ assets.dataJs() }} : show all data js files
{{ data }}: show all data from request
{{ session }}
{{ dump(data) }}: dump data that you want to see in browser
{{ $n('param_name/node1/0/node2/node3', 'default value') }}: navigation in data on a nested variable in params
{{ $rq }}: Current request class
{{ $e.route }}: Current route path
{{ $e.routePath }}: Current route path (full path)
{{ $e.routeKey }}: Current route key
{{ $e.isKey('key') }}: Check if current route is the given key
{{ $e.hasKey(['key1', 'key2']) }}: Check if current route is one of the given keys

{{ $e.routeUrl('key', {'param': 'value'}, {'query': 'value'}) }}: Get url of the given key, with params and queries that are optional
{{ $e.uri }}: Current uri
{{ $e.uriString }}: Current uri string
{{ $e.path }}: Current path
{{ $e.pathString }}: Current path string
{{ $e.isPath('/path') }}: Check if current path is the given path
{{ $e.endpoint }}: Current endpoint
{{ $e.url(path) }}: Make url from path
{{ $e.urlToLanguage(language) }}: Make url to change language when a specific language need to change
{{ $e.urlParam(path, {'param': 'value'}) }}: Make url with params
{{ $e.getCookie('key', 'default value') }}: Get cookie value
{{ $e.ln }}: Current language
{{ $e.dir }}: Current language direction (rtl or ltr), you have to set it in your language file by this key: language.en_dir or language.fa_dir
{{ $e.langs }}: All languages: [{ code: 'en', label: 'English', contry: 'United States' }]
{{ $e.widgetPath('path') }} : Get widget path
{{ $e.randomString(4) }} : Generate random string 4 is length of chars
{{ $e.toString(value) }} : Convert value to string
{{ $t('key') }}: Translate a key