SOLVED Provisioning templates syntax

Status
Not open for further replies.

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,412
376
83
Can anyone point me in right direction to find any information on the syntax available in the provision template files?

For example here is an IF construct:
{if isset($dns_server_primary)}network.primary_dns = {$dns_server_primary}{/if}

This also contains an isset() function.

I would like to find out what constructs and functions are available to use in template files.

Kind regards,
Adrian.
 

markjcrane

Active Member
Staff member
Jul 22, 2018
448
162
43
49
PHP Smarty 3. However I try not to use too advanced syntax for the template engine because if we switch to a different template engine that would make the process all the more complex. So consider using the template engine lightly and not treating it fully like its own programming language. We use enough syntax just to get what we need done and I've tried to avoid anything elaborate.
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,412
376
83
PHP Smarty 3. However I try not to use too advanced syntax for the template engine because if we switch to a different template engine that would make the process all the more complex. So consider using the template engine lightly and not treating it fully like its own programming language. We use enough syntax just to get what we need done and I've tried to avoid anything elaborate.

Thankyou Mark, that is very helpful.

I won't bore you with exactly why I need to do this (router with strange NAT behavour). I wanted each device (Yealink) to get provisioned with a different SIP Local port, so, as all of my auth IDs are numeric, and only 3 digits, I simply do:

account.1.sip_listen_port = 15{$auth_id_1}
...
account.6.sip_listen_port = 15{$auth_id_6}

In order to add more safety to this I was considering using a substr to limit the length of $auth_id_X and maybe also an isnumeric test.

Kind regards,
Adrian.
 
Status
Not open for further replies.