首页 安企CMS模板标签手册 文档标签

文档详情标签

说明:用于获取文档详情数据

使用方法:{% archiveDetail with name="变量名称" id="1" %} 变量名称不是必须的,设置了变量名称后,后续可以通过变量名称来调用,而不设置变量名称,则是直接输出结果。

archiveDetail 支持的参数有:

  • 文档ID id
    id 不是必须的,默认会获取当前文档。如果需要指定文档,可以通过设置id来达到目的。


name 参数可用的字段有:

  • 文档ID Id
  • 文档标题 Title
  • 文档链接 Link
  • 文档关键词 Keywords
  • 文档描述 Description
  • 文档内容 Content
  • 文档分类ID CategoryId
  • 文档浏览量 Views
  • 文档封面图片 Images
  • 文档封面首图 Logo
  • 文档封面缩略图 Thumb
  • 文档评论数量 CommentCount
  • 文档分类 Category
  • 文档添加时间 CreatedTime 时间戳,需要使用格式化时间戳为日期格式 {{stampToDate(item.CreatedTime, "2006-01-02")}}
  • 文档更新时间 UpdatedTime 时间戳,需要使用格式化时间戳为日期格式 {{stampToDate(item.UpdatedTime, "2006-01-02 15:04:05")}}
  • 文档标签
  • 文档模型设置的其他字段参数


文档ID Id

标签用法:{% archiveDetail with name="Id" %}


{# 默认用法,自动获取当前页面文档 #}
<div>分类标题:{% archiveDetail with name="Id" %}</div>
{# 获取指定文档id的文档字段 #}
<div>分类标题:{% archiveDetail with name="Id" id="1" %}</div>
{# 自定义字段名称 #}
<div>分类标题:{% archiveDetail archiveId with name="Id" %}{{archiveId}}</div>
<div>分类标题:{% archiveDetail archiveId with name="Id" id="1" %}{{archiveId}}</div>


文档标题 Title

标签用法:{% archiveDetail with name="Title" %}


{# 默认用法,自动获取当前页面文档 #}
<div>文档标题:{% archiveDetail with name="Title" %}</div>
{# 获取指定文档id的文档字段 #}
<div>文档标题:{% archiveDetail with name="Title" id="1" %}</div>
{# 自定义字段名称 #}
<div>文档标题:{% archiveDetail archiveTitle with name="Title" %}{{archiveTitle}}</div>
<div>文档标题:{% archiveDetail archiveTitle with name="Title" id="1" %}{{archiveTitle}}</div>


文档链接 Link

标签用法:{% archiveDetail with name="Link" %}


{# 默认用法,自动获取当前页面文档 #}
<div>文档链接:{% archiveDetail with name="Link" %}</div>
{# 获取指定文档id的文档字段 #}
<div>文档链接:{% archiveDetail with name="Link" id="1" %}</div>
{# 自定义字段名称 #}
<div>文档链接:{% archiveDetail archiveLink with name="Link" %}{{archiveLink}}</div>
<div>文档链接:{% archiveDetail archiveLink with name="Link" id="1" %}{{archiveLink}}</div>


文档描述 Description

标签用法:{% archiveDetail with name="Description" %}


{# 默认用法,自动获取当前页面文档 #}
<div>文档描述:{% archiveDetail with name="Description" %}</div>
{# 获取指定文档id的文档字段 #}
<div>文档描述:{% archiveDetail with name="Description" id="1" %}</div>
{# 自定义字段名称 #}
<div>文档描述:{% archiveDetail archiveDescription with name="Description" %}{{archiveDescription}}</div>
<div>文档描述:{% archiveDetail archiveDescription with name="Description" id="1" %}{{archiveDescription}}</div>


文档内容 Content

标签用法:{% archiveDetail with name="Content" %}


{# 默认用法,自动获取当前页面文档 #}
<div>文档内容:{% archiveDetail with name="Content" %}</div>
{# 获取指定文档id的文档字段 #}
<div>文档内容:{% archiveDetail with name="Content" id="1" %}</div>
{# 自定义字段名称 #}
<div>文档内容:{% archiveDetail archiveContent with name="Content" %}{{archiveContent|safe}}</div>
<div>文档内容:{% archiveDetail archiveContent with name="Content" id="1" %}{{archiveContent|safe}}</div>


文档分类ID CategoryId

标签用法:{% archiveDetail with name="CategoryId" %}


{# 默认用法,自动获取当前页面文档 #}
<div>文档分类ID:{% archiveDetail with name="CategoryId" %}</div>
{# 获取指定文档id的文档字段 #}
<div>文档分类ID:{% archiveDetail with name="CategoryId" id="1" %}</div>
{# 自定义字段名称 #}
<div>文档分类ID:{% archiveDetail archiveCategoryId with name="CategoryId" %}{{archiveCategoryId}}</div>
<div>文档分类ID:{% archiveDetail archiveCategoryId with name="CategoryId" id="1" %}{{archiveCategoryId}}</div>


文档浏览量 Views

标签用法:{% archiveDetail with name="Views" %}


{# 默认用法,自动获取当前页面文档 #}
<div>文档浏览量:{% archiveDetail with name="Views" %}</div>
{# 获取指定文档id的文档字段 #}
<div>文档浏览量:{% archiveDetail with name="Views" id="1" %}</div>
{# 自定义字段名称 #}
<div>文档浏览量:{% archiveDetail archiveViews with name="Views" %}{{archiveViews}}</div>
<div>文档浏览量:{% archiveDetail archiveViews with name="Views" id="1" %}{{archiveViews}}</div>


文档封面首图 Logo

标签用法:{% archiveDetail with name="Logo" %}


{# 默认用法,自动获取当前页面文档 #}
<div>文档封面首图:<img src="{% archiveDetail with name="Logo" %}" alt=""/></div>
{# 获取指定文档id的文档字段 #}
<div>文档封面首图:<img src="{% archiveDetail with name="Logo" id="1" %}" alt=""/></div>
{# 自定义字段名称 #}
<div>文档封面首图:<img src="{% archiveDetail archiveLogo with name="Logo" %}{{archiveLogo}}" alt=""/></div>
<div>文档封面首图:<img src="{% archiveDetail archiveLogo with name="Logo" id="1" %}{{archiveLogo}}" alt=""/></div>


文档封面缩略图 Thumb

标签用法:{% archiveDetail with name="Thumb" %}


{# 默认用法,自动获取当前页面文档 #}
<div>文档封面缩略图:<img src="{% archiveDetail with name="Thumb" %}" alt=""/></div>
{# 获取指定文档id的文档字段 #}
<div>文档封面缩略图:<img src="{% archiveDetail with name="Thumb" id="1" %}" alt=""/></div>
{# 自定义字段名称 #}
<div>文档封面缩略图:<img src="{% archiveDetail archiveThumb with name="Thumb" %}{{archiveThumb}}" alt=""/></div>
<div>文档封面缩略图:<img src="{% archiveDetail archiveThumb with name="Thumb" id="1" %}{{archiveThumb}}" alt=""/></div>


文档封面图片 Images

Images 是一组图片,因此需要使用自定义方式来获取并循环输出

标签用法:{% archiveDetail archiveImages with name="Images" %}


{# 自定义字段名称 #}
<div>文档封面图片:
    {% archiveDetail archiveImages with name="Images" %}
    {% for item in archiveImages %}
        <img src="{{item}}" alt=""/>
    {% endfor %}
</div>
<div>文档封面图片:
    {% archiveDetail archiveImages with name="Images" id="1" %}
    {% for item in archiveImages %}
        <img src="{{item}}" alt=""/>
    {% endfor %}
</div>


文档添加时间 CreatedTime

CreatedTime 支持预格式化时间。用2006-01-02表示年-月-日,用15:04::05表示时分秒。如需要显示格式为 2021年06月30日,可以写成format="2006年01月02日",如需要显示格式为 2021/06/30 12:30,可以写成format="2006/01/02 15:04"。如果不设置format,在默认用法下,它会自动被格式化为2006-01-02

标签用法:{% archiveDetail with name="CreatedTime" format="2006-01-02 15:04" %}


{# 默认用法,自动获取当前页面文档 #}
<div>文档添加时间:{% archiveDetail with name="CreatedTime" %}</div>
<div>文档添加时间:{% archiveDetail with name="CreatedTime" format="2006-01-02 15:04" %}</div>
{# 获取指定文档id的文档字段 #}
<div>文档添加时间:{% archiveDetail with name="CreatedTime" id="1" %}</div>
<div>文档添加时间:{% archiveDetail with name="CreatedTime" id="1" format="2006-01-02 15:04" %}</div>
{# 自定义字段名称 #}
<div>文档添加时间:{% archiveDetail archiveCreatedTime with name="CreatedTime" %}{{archiveCreatedTime}}</div>
<div>文档添加时间:{% archiveDetail archiveCreatedTime with name="CreatedTime" id="1" %}{{archiveCreatedTime}}</div>
<div>文档添加时间:{% archiveDetail archiveCreatedTime with name="CreatedTime" format="2006-01-02" %}{{archiveCreatedTime}}</div>
<div>文档添加时间:{% archiveDetail archiveCreatedTime with name="CreatedTime" id="1" format="2006-01-02 15:04" %}{{archiveCreatedTime}}</div>


文档更新时间 UpdatedTime

UpdatedTime 支持预格式化时间。用2006-01-02表示年-月-日,用15:04::05表示时分秒。如需要显示格式为 2021年06月30日,可以写成format="2006年01月02日",如需要显示格式为 2021/06/30 12:30,可以写成format="2006/01/02 15:04"。如果不设置format,在默认用法下,它会自动被格式化为2006-01-02

标签用法:{% archiveDetail with name="UpdatedTime" format="2006-01-02 15:04" %}


{# 默认用法,自动获取当前页面文档 #}
<div>文档更新时间:{% archiveDetail with name="UpdatedTime" %}</div>
<div>文档更新时间:{% archiveDetail with name="UpdatedTime" format="2006-01-02 15:04" %}</div>
{# 获取指定文档id的文档字段 #}
<div>文档更新时间:{% archiveDetail with name="UpdatedTime" id="1" %}</div>
<div>文档更新时间:{% archiveDetail with name="UpdatedTime" id="1" format="2006-01-02 15:04" %}</div>
{# 自定义字段名称 #}
<div>文档更新时间:{% archiveDetail archiveUpdatedTime with name="UpdatedTime" %}{{archiveUpdatedTime}}</div>
<div>文档更新时间:{% archiveDetail archiveUpdatedTime with name="UpdatedTime" id="1" %}{{archiveUpdatedTime}}</div>
<div>文档更新时间:{% archiveDetail archiveUpdatedTime with name="UpdatedTime" format="2006-01-02" %}{{archiveUpdatedTime}}</div>
<div>文档更新时间:{% archiveDetail archiveUpdatedTime with name="UpdatedTime" id="1" format="2006-01-02 15:04" %}{{archiveUpdatedTime}}</div>


文档分类 Category


{% archiveDetail archiveCategory with name="Category" %}
<a href="{{ archiveCategory.Link }}">
    <span>分类ID:{{archiveCategory.Id}}</span>
    <span>分类名称:{{archiveCategory.Title}}</span>
    <span>分类链接:{{archiveCategory.Link}}</span>
    <span>分类描述:{{archiveCategory.Description}}</span>
    <span>上级分类ID:{{archiveCategory.ParentId}}</span>
</a>
<div>缩略图大图:<img style="width: 200px" src="{{archiveCategory.Logo}}" alt="{{archiveCategory.Title}}" /></div>
<div>缩略图:<img style="width: 200px" src="{{archiveCategory.Thumb}}" alt="{{archiveCategory.Title}}" /></div>

{# 或者使用categoryDetail方式调用 #}
<span>分类ID:{% categoryDetail with name="Id" id=archive.Id %}</span>
<span>分类名称:{% categoryDetail with name="Title" id=archive.Id %}</span>
<span>分类链接:{% categoryDetail with name="Link" id=archive.Id %}</span>
<span>分类描述:{% categoryDetail with name="Description" id=archive.Id %}</span>
<span>上级分类ID:{% categoryDetail with name="ParentId" id=archive.Id %}</span>
<div>缩略图大图:<img style="width: 200px" src="{% categoryDetail with name="Logo" id=archive.Id %}" /></div>
<div>缩略图:<img style="width: 200px" src="{% categoryDetail with name="Thumb" id=archive.Id %}" /></div>


文档标签


{% tagList tags with type="1" limit="10" %}
{% for item in tags %}
<a href="{{item.Link}}">{{item.Title}}</a>
{% endfor %}
{% endtagList %}


- 文档模型设置的其他字段参数


{% archiveParams params %}
<div class="extra">
    <table class="layui-table">
        <colgroup>
            <col width="100">
            <col>
        </colgroup>
        <tbody>
        {% for item in params %}
        <tr>
            <td>{{item.Name}}</td>
            <td>
                {{item.Value}}
            </td>
        </tr>
        {% endfor %}
        </tbody>
    </table>
</div>
{% endarchiveParams %}