相关文章#relevantArticles()

相关文章(relevantArticles)

说明

此指令是文章页面,读取相关的文章

语法

#relevantArticles(article)
#for(article :relevantArticles )
<a href="#(article.url ??)" class="col-6 col-md-3 post-relevant-item">
<div style="background:url('#(article.showImage ??)')">
	<div class="title">#(article.title ??)</div>
</div>
</a>
#end
#end

| 参数 | 说明 | | -------- | -------- | | article| 文章对象| | count| 数量 |

返回参数

articles:文章集合信息

[
    {
        "flag": "plain",
        "orderNumber": 0,
        "showImage": "https://img.ifuntools.cn/file_images/article/20180606152826410720015.png",
        "title": "Apeaksoft iPhone Transfer 1.1.10....IOS数据传输工具",
        "content": "<p>IOS数据传输工具</p> \n<p>它能够在iOS设备和电脑之间或从iOS到iTunes之间备份短信,联系人,图片,音乐,视频,书籍,PDF等,让你可以自由的在电脑和iPhone之前传输文件。</p>",
        "draft": false,
        "htmlView": "article_free.html",
        "modified": 1608082793000,
        "id": 1807,
        "text": "IOS数据传输工具 它能够在iOS设备和电脑之间或从iOS到iTunes之间备份短信,联系人,图片,音乐,视频,书籍,PDF等,让你可以自由的在电脑和iPhone之前传输文件。",
        "viewCount": 165,
        "normal": true,
        "images": [
            "https://img.ifuntools.cn/file_images/article/20180606152826410720015.png",
            "https://img.ifuntools.cn/file_images/article/20180606152826412884720.png",
            "https://img.ifuntools.cn/file_images/article/20180606152826409643121.png",
            "https://img.ifuntools.cn/file_images/article/20180606152826413584618.png",
            "https://img.ifuntools.cn/blog/20191024/xvamUkAAIwPg.png?imageslim"
        ],
        "thumbnail": "https://img.ifuntools.cn/file_images/article/20180606152826410720015.png",
        "created": 1596823382000,
        "commentEnable": true,
        "active": false,
        "userId": 1,
        "orignalContent": "IOS数据传输工具\n\n它能够在iOS设备和电脑之间或从iOS到iTunes之间备份短信,联系人,图片,音乐,视频,书籍,PDF等,让你可以自由的在电脑和iPhone之前传输文件。",
        "url": "/article/1807",
        "commentCount": 18,
        "commentStatus": true,
        "trash": false,
        "editMode": "markdown",
        "firstImage": "https://img.ifuntools.cn/file_images/article/20180606152826410720015.png",
        "style": "free",
        "status": "normal"
    }
]

Article文章属性在整个JPress里面都是同一份,后面不再说明

示例

读取相关文章
#relevantArticles(article)
#for(article :relevantArticles )
<a href="#(article.url ??)" class="col-6 col-md-3 post-relevant-item">
	<div style="background:url('#(article.showImage ??)')">
		<div class="title">#(article.title ??)</div>
	</div>
</a>
#end
#end
	
	
读取5篇相关文章
#relevantArticles(article,count=5)
#for(article :relevantArticles )
<a href="#(article.url ??)" class="col-6 col-md-3 post-relevant-item">
	<div style="background:url('#(article.showImage ??)')">
		<div class="title">#(article.title ??)</div>
	</div>
</a>
#end
#end

			

加入我们!

如果你想系统学习JPress涉及到的知识点,或者希望有人解答你在深度使用JPress时遇到问题,
加入QQ群是个很不错的选择