Description: Used to obtain document details data
How to use:{% archiveDetail 变量名称 with name="字段名称" id="1" %}
The variable name is not necessary. After setting the variable name, you can call it through the variable name in the future. Without setting the variable name, the result will be output directly.
The supported parameters of archiveDetail are:
- Document ID
id
id
It is not necessary, the current document will be retrieved by default. If you need to specify a document, you can set the id to achieve the purpose. - Document URL alias
token
token
It is not necessary, the current document will be retrieved by default. If you need to specify a document, you can set the id or token to achieve the purpose. - Site ID
siteId
siteId
Generally, there is no need to fill in it. If you use the background multi-site management to create multiple sites and want to call data from other sites, you can specify itsiteId
To implement the data calling the specified site.
Document details page, you can also use it directly{{archive.文档字段}}
To call the document field content.
If you are currently under the combined document URL, the URL form:"/{module}/{id}/c-{combine}.html"
For example: "/tour/1/c-2.html", it supports multiple document combination comparison, and supports up to 5. If there are multiple, use隔开
,like:"/cpu/11/c-12-13-14.html"
, then you can usecombineIds
orcombineArchives
To render and compare data.
The fields available for the name parameter are:
- Document ID
Id
- Document title
Title
- Document SEO title
SeoTitle
- Document link
Link
- Document keywords
Keywords
- Document description
Description
- Document content
Content
Support lazy image loading required tagslazy="data-src"
- Title of document content
ContentTitles
Returns an array - Document model ID
ModuleId
- Document model ID
ParentId
- Document Classification ID
CategoryId
- Document specification link
CanonicalUrl
- Document user ID
UserId
- price
Price
- in stock
Stock
- Document reading level
ReadLevel
- Original link to the document
OriginUrl
- Document view count
Views
- Flag properties of a document
Flag
- Document cover picture
Images
- First image of the document cover
Logo
- Document cover thumbnail
Thumb
- Number of document comments
CommentCount
- Document classification
Category
- Document addition time
CreatedTime
Time stamp, need to use formatted timestamps as date format{{stampToDate(item.CreatedTime, "2006-01-02")}}
- Document update time
UpdatedTime
Time stamp, need to use formatted timestamps as date format{{stampToDate(item.UpdatedTime, "2006-01-02 15:04:05")}}
- Document tags
- Other field parameters for document model settings
Document IDId
Tag usage:{% 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>
Document titleTitle
Tag usage:{% 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>
Document linkLink
Tag usage:{% 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>
Document descriptionDescription
Tag usage:{% 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>
Document contentContent
Tag usage:{% archiveDetail with name="Content" %}
The Content field supports lazyload usage of images. Need to uselazy="{定义的src名}"
To handle it, for example, the lazyload plugin you use needs to<img src="" />
Change to<img data-src="" />
, then call it like thislazy="data-src"
After the Content field is enabled, the content will automatically convert the content to html. After closing the Markdown editor, the Content content will not automatically convert the content to html. But you can manually specify whether to convert, you need to addrender
parameter. acceptfalse|true
Two values.render=false
No Markdown to html operation is performed.render=true
Make a conversion.
{# 默认用法,自动获取当前页面文档 #}
<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>
{# lazyload 替换 #}
<div>文档内容:{% archiveDetail archiveContent with name="Content" lazy="data-src" %}{{archiveContent|safe}}</div>
{# markdown 转 html #}
<div>文档内容:{% archiveDetail archiveContent with name="Content" render=true %}{{archiveContent|safe}}</div>
{# 不进行markdown转换 #}
<div>文档内容:{% archiveDetail archiveContent with name="Content" render=false %}{{archiveContent|safe}}</div>
Title of document contentContentTitles
Tag usage:{% archiveDetail contentTitles with name="ContentTitles" %}
The returned is an array with the objects contained in it:{Title: "标题", Tag: "标签", Level: 层级, Prefix: "前缀"}
You need to use a loop to call:
{% archiveDetail contentTitles with name="ContentTitles" %}
<div>
{% for item in contentTitles %}
<div class="{{item.Tag}}" level="{{item.Level}}">{{item.Prefix}} {{item.Title}}</div>
{% endfor %}
</div>
Document Classification IDCategoryId
Tag usage:{% 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>
Document view countViews
Tag usage:{% 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>
First image of the document coverLogo
Tag usage:{% 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>
Document cover thumbnailThumb
Tag usage:{% 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>
Document cover pictureImages
Images is a set of images, so you need to use a custom way to get and loop the output.
Tag usage:{% 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>
Document addition timeCreatedTime
CreatedTime supports preformatted times. use2006-01-02
Indicates year-month-day,15:04::05
Indicates time, minute and second. If the display format is June 30, 2021, you can write it asformat="2006年01月02日"
, if the display format is 2021/06/30 12:30, you can write it asformat="2006/01/02 15:04"
. If format is not set, it will be automatically formatted as2006-01-02
.
Tag usage:{% 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>
Document update timeUpdatedTime
UpdatedTime supports preformatted times. use2006-01-02
Indicates year-month-day,15:04::05
Indicates time, minute and second. If the display format is June 30, 2021, you can write it asformat="2006年01月02日"
, if the display format is 2021/06/30 12:30, you can write it asformat="2006/01/02 15:04"
. If format is not set, it will be automatically formatted as2006-01-02
.
Tag usage:{% 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>
Document classificationCategory
{% 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 src="{{archiveCategory.Logo}}" alt="{{archiveCategory.Title}}" /></div>
<div>缩略图:<img 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 src="{% categoryDetail with name="Logo" id=archive.Id %}" /></div>
<div>缩略图:<img src="{% categoryDetail with name="Thumb" id=archive.Id %}" /></div>
Document tags
{% tagList tags with limit="10" %}
{% for item in tags %}
<a href="{{item.Link}}">{{item.Title}}</a>
{% endfor %}
{% endtagList %}
Other field parameters for document model settings
Loop all fields
{% archiveParams params %}
<div>
{% for item in params %}
<div>
<span>{{item.Name}}:</span>
<span>{{item.Value}}</span>
</div>
{% endfor %}
</div>
{% endarchiveParams %}
If you want to display only the content of a custom field, if your custom field isauthor
, then you can call it like this in the template:
{% archiveDetail with name="author" %}
Common usage examples
- For common article details, display document title, document classification, document release time, document label, document view count, document details on the document details page. As shown in the picture:
Call code example (the code does not contain css style control)
<article>
<h1>{% archiveDetail with name="Title" %}</h1>
<div>
<a href="{% categoryDetail with name='Link' %}">{% categoryDetail with name='Title' %}</a>
<span>{% archiveDetail with name="CreatedTime" format="2006-01-02" %}</span>
{% tagList tags with limit="10" %}
{% for item in tags %}
<a href="{{item.Link}}">{{item.Title}}</a>
{% endfor %}
{% endtagList %}
<span>{% archiveDetail with name="Views" %}°</span>
</div>
<div>
{%- archiveDetail articleContent with name="Content" %}
{{articleContent|safe}}
</div>
</article>
- Common product details, display product pictures, product names, product parameters, product introduction, and product details on the document details page. As shown in the picture:
Call code example (the code does not contain css style control)
<article>
<div>
<div>
<img src="{% archiveDetail with name='Logo' %}" alt="{% archiveDetail with name='Title' %}" />
</div>
<div>
<h1>{% archiveDetail with name="Title" %}</h1>
{% archiveParams params %}
{% for item in params %}
<div>
<span>{{item.Name}}:</span>
<span>{{item.Value}}</span>
</div>
{% endfor %}
{% endarchiveParams %}
<div>{% archiveDetail with name="Description" %}</div>
<div>
<a href="tel:{% contact with name='Cellphone' %}" rel="nofollow">电话联系:{% contact with name="Cellphone" %}</a>
</div>
</div>
</div>
<div>
<div>产品详情</div>
<div>
{%- archiveDetail articleContent with name="Content" %}
{{articleContent|safe}}
</div>
</div>
</article>