Category Details Tags

Description: Used to obtain the classification details of the document

How to use:{% categoryDetail 变量名称 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 categoryDetail are:

  • Category IDid idNot required, the current category will be fetched by default. To specify a category, you can set the id to achieve this.
  • Category URL aliastoken tokenNot required, it will fetch the current category by default. To specify a category, you can set the id or token.
  • Site IDsiteId siteIdGenerally, 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 itsiteIdTo implement the data calling the specified site.

The fields available for the name parameter are:

  • Category IDId
  • Classification titleTitle
  • Category LinksLink
  • Classification DescriptionDescription
  • Classified contentContent
  • Parent Category IDParentId
  • Classified thumbnailsLogo
  • Classification thumbnailsThumb
  • Category Banner GalleryImages
  • Number of documents classifiedArchiveCount
  • Classification other field parameters for document model settings

Category IDId

Tag usage:{% categoryDetail with name="Id" %}

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

Classification titleTitle

Tag usage:{% categoryDetail with name="Title" %}

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

Category LinksLink

Tag usage:{% categoryDetail with name="Link" %}

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

Classification DescriptionDescription

Tag usage:{% categoryDetail with name="Description" %}

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

Classified contentContent

Tag usage:{% categoryDetail with name="Content" %}

The Content field will automatically convert the content to html when the Markdown editor is enabled. After the Markdown editor is disabled, the Content content will not automatically convert to html. However, you can manually specify whether to convert, you need to addrenderparameter. acceptfalse|trueTwo values.render=falseNo Markdown to HTML conversion operation,.render=trueMake a conversion.

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

Parent Category IDParentId

Tag usage:{% categoryDetail with name="ParentId" %}

{# 默认用法,自动获取当前页面分类 #}
<div>上级分类ID:{% categoryDetail with name="ParentId" %}</div>
{# 获取指定分类id的分类字段 #}
<div>上级分类ID:{% categoryDetail with name="ParentId" id="1" %}</div>
{# 自定义字段名称 #}
<div>上级分类ID:{% categoryDetail categoryParentId with name="ParentId" %}{{categoryParentId}}</div>
<div>上级分类ID:{% categoryDetail categoryParentId with name="ParentId" id="1" %}{{categoryParentId}}</div>

Number of documents classifiedArchiveCount

Tag usage:{% categoryDetail with name="ArchiveCount" %}

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

Classification other field parameters for document model settings

If you want to display the contents of a custom field, if your custom field isauthor, then you can call it like this in the template:

{% categoryDetail with name="author" %}

Usage of custom field parameters, for example, you have customized a field for a group chart.catimagesAnd want to display them on the front end? You can write it like this:

{% categoryDetail catimages with name="catimages" %}
<ul class="category-images">
  {% for img in catimages %}
  <li><img src="{{img}}" /></li>
  {% endfor %}
</ul>

If you want to loop out all custom fields, you can use this:

{% categoryDetail extras with name="Extra" %}
{% for field in extras %}
  <div>{{field.Name}}:{{field.Value}}</div>
{% endfor %}

It will loop through all custom fields by default, if you don't want a particular custom field to appear, for example, you don't want toauthor/priceThe field is displayed on the page and can be used like this:

{% categoryDetail extras with name="Extra" %}
{% for field in extras %}
{% if field.Name != 'author' and field.Name != 'price' %}
  <div>{{field.Name}}:{{field.Value}}</div>
{% endif %}
{% endfor %}

Classified thumbnailsLogo

Tag usage:{% categoryDetail with name="Logo" %}

{# 默认用法,自动获取当前页面分类 #}
<div>缩略图大图:<img style="width: 200px" src="{% categoryDetail with name="Logo" %}" alt="{% categoryDetail with name="Title" %}" /></div>
{# 获取指定分类id的分类字段 #}
<div>缩略图大图:<img style="width: 200px" src="{% categoryDetail with name="Logo" id="1" %}" alt="{% categoryDetail with name="Title" id="1" %}" /></div>
{# 自定义字段名称 #}
<div>缩略图大图:{% categoryDetail categoryLogo with name="Logo" %}<img style="width: 200px" src="{{categoryLogo}}" alt="{% categoryDetail with name="Title" %}" /></div>
<div>缩略图大图:{% categoryDetail categoryLogo with name="Logo" id="1" %}<img style="width: 200px" src="{{categoryLogo}}" alt="{% categoryDetail with name="Title" %}" /></div>

Classification thumbnailsThumb

Tag usage:{% categoryDetail with name="Thumb" %}

{# 默认用法,自动获取当前页面分类 #}
<div>缩略图大图:<img style="width: 200px" src="{% categoryDetail with name="Thumb" %}" alt="{% categoryDetail with name="Title" %}" /></div>
{# 获取指定分类id的分类字段 #}
<div>缩略图大图:<img style="width: 200px" src="{% categoryDetail with name="Thumb" id="1" %}" alt="{% categoryDetail with name="Title" id="1" %}" /></div>
{# 自定义字段名称 #}
<div>缩略图大图:{% categoryDetail categoryThumb with name="Thumb" %}<img style="width: 200px" src="{{categoryThumb}}" alt="{% categoryDetail with name="Title" %}" /></div>
<div>缩略图大图:{% categoryDetail categoryThumb with name="Thumb" id="1" %}<img style="width: 200px" src="{{categoryThumb}}" alt="{% categoryDetail with name="Title" %}" /></div>

Category Banner GalleryImages

Tag usage:{% categoryDetail categoryImages with name="Images" %}{% for item in categoryImages %}<img src="{{item}}" alt="{% categoryDetail with name="Title" %}" />{% endfor %}

{% categoryDetail categoryImages with name="Images" %}
<ul>
{% for item in categoryImages %}
  <li>
    <img src="{{item}}" alt="{% categoryDetail with name="Title" %}" />
  </li>
{% endfor %}
</ul>

The code will demonstrate multiple slides. If you only need the first image and want to check if the image exists, you can use the following method:

{% categoryDetail bannerImages with name="Images" %}
{% if bannerImages %}
{% set pageBanner = bannerImages[0] %}
{% endif %}
<img src="{{pageBanner}}" />

If you want to use it as a background image, you can do this:

{% categoryDetail bannerImages with name="Images" %}
{% if bannerImages %}
{% set pageBanner = bannerImages[0] %}
{% endif %}
<div class="page-banner" style="background: url({{pageBanner}}) no-repeat;">
</div>