說明:用于獲取系統(tǒng)配置信息
使用方法:{% system 變量名稱 with name="字段名稱" %}
,變量名稱不是必須的,設(shè)置了變量名稱后,后續(xù)可以通過變量名稱來調(diào)用,而不設(shè)置變量名稱,則是直接輸出結(jié)果。
system
支持的參數(shù)有siteId
siteId
一般不需要填寫,如果你使用后臺(tái)的多站點(diǎn)管理創(chuàng)建了多個(gè)站點(diǎn),并且想調(diào)用其他站點(diǎn)的數(shù)據(jù),則可以通過指定 siteId
來實(shí)現(xiàn)調(diào)用指定站點(diǎn)的數(shù)據(jù)。name 參數(shù)可用的字段名稱有:
SiteName
SiteLogo
SiteIcp
SiteCopyright
BaseUrl
MobileUrl
TemplateUrl
TemplateName
SiteCloseTips
Language
后臺(tái)自定義設(shè)置的參數(shù)名
SiteName
標(biāo)簽用法:{% system with name="SiteName" %}
{# 默認(rèn)用法 #}
<div>網(wǎng)站名稱:{% system with name="SiteName" %}</div>
{# 自定義名稱調(diào)用 #}
<div>網(wǎng)站名稱:{% system siteName with name="SiteName" %}{{siteName}}</div>
SiteLogo
標(biāo)簽用法:{% system with name="SiteLogo" %}
{# 默認(rèn)用法 #}
<img src="{% system with name="SiteLogo" %}" alt="{% system with name="SiteName" %}" />
{# 自定義名稱調(diào)用 #}
<img src="{% system siteLogo with name="SiteLogo" %}{{siteLogo}}" alt="{% system siteName with name="SiteName" %}{{siteName}}" />
SiteIcp
標(biāo)簽用法:{% system with name="SiteIcp" %}
{# 默認(rèn)用法 #}
<p><a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{% system with name="SiteIcp" %}</a> ?2021 kandaoni.com. All Rights Reserved</p>
{# 自定義名稱調(diào)用 #}
<p><a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">{% system siteIcp with name="SiteIcp" %}{{siteIcp}}</a> ?2021 kandaoni.com. All Rights Reserved</p>
SiteCopyright
標(biāo)簽用法:{% system with name="SiteCopyright" %}
{# 默認(rèn)用法 #}
<div>{% system with name="SiteCopyright" %}</div>
{# 自定義名稱調(diào)用 #}
<div>{% system siteCopyright with name="SiteCopyright" %}{{siteCopyright|safe}}</div>
BaseUrl
標(biāo)簽用法:{% system with name="BaseUrl" %}
{# 默認(rèn)用法 #}
<div>首頁地址:{% system with name="BaseUrl" %}</div>
{# 自定義名稱調(diào)用 #}
<div>首頁地址:{% system baseUrl with name="BaseUrl" %}{{baseUrl|safe}}</div>
MobileUrl
標(biāo)簽用法:{% system with name="MobileUrl" %}
{# 默認(rèn)用法 #}
<div>移動(dòng)端地址:{% system with name="MobileUrl" %}</div>
{# 自定義名稱調(diào)用 #}
<div>移動(dòng)端地址:{% system mobileUrl with name="MobileUrl" %}{{mobileUrl|safe}}</div>
TemplateUrl
標(biāo)簽用法:{% system with name="TemplateUrl" %}
{# 默認(rèn)用法 #}
<link href="{% system with name="TemplateUrl" %}/css/style.css" rel="stylesheet">
{# 自定義名稱調(diào)用 #}
<div>靜態(tài)文件地址:{% system templateUrl with name="TemplateUrl" %}{{templateUrl|safe}}</div>
Language
標(biāo)簽用法:{% system with name="Language" %}
{# 默認(rèn)用法 #}
<html lang="{% system with name='Language' %}">
標(biāo)簽用法:{% now "2006" %}
后面的2006 是時(shí)間格式化字符串,格式為Golang支持的格式。
僅僅顯示年:
{% now "2006" %}
顯示年月日
{% now "2006-01-02" %}
顯示年月日時(shí)分秒
{% now "2006-01-02 15:04:05" %}