Template Config Files
Using config_load
config_load
You may use the config_load
built-in function to load arbitrary configuration files from the template directory.
Example Usage:
{config_load file="./payment_types.conf" section="{$order.payment_type}"}
Thank you for paying with {#paymentTypeName#}
Where ./payment_types.conf
could look something like:
[adyen]
paymentTypeName = Adyen
imageFile = "adyen-logo.png"
[braintree]
paymentTypeName = Braintree
imageFile = "braintree-assets/light.svg"
[paypal]
paymentTypeName = Pay Pal
By using sections you can use your config files like a 2 dimensional array of data where the section name partitions the key names within each section.
More information can be found in the smarty documentation: https://www.smarty.net/docsv2/en/language.function.config.load.tpl
Updated almost 2 years ago