config_load函數(shù)
config_load函數(shù)
使用方式:
設(shè)定檔有可能包含多個(gè)部分,此時(shí)可以使用附加屬性section 指定從哪一部分取得變數(shù).
注意:設(shè)定檔中的section 和模板內(nèi)建函數(shù)section 只是命名相同,毫不相干。
eg:
test.html:
{config_load file="colors.conf" section="Customer"} <html> <title>{#pageTitle#}</title> <body bgcolor="{#bodyBgColor#}"> <table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}"> <tr bgcolor="{#rowBgColor#}"> <td>First</td> <td>Last</td> <td>Address</td> </tr> </table> </body> </html>
colors.conf:
#注釋 #段落變量 [Customer] pageTitle='顧客表' bodyBgColor='#00f' tableBorderSize='1' tableBgColor='skyblue' rowBgColor='red' tableBgColor='skyblue' [Person] pageTitle='所有人表' bodyBgColor='#eee' tableBorderSize='1' tableBgColor='skyblue' rowBgColor='red' tableBgColor='skyblue' [other] other='這是其他'
執(zhí)行結(jié)果:
section ="Person"時(shí)運(yùn)行結(jié)果: