简体   繁体   English

在ModX中创建文章预览?

[英]Create article preview in ModX?

How can I create preview of my articles(which are in the resource "articles" ) using their [[*description]] and [[*introtext]] in the right sidebar on another resources page, called "services" (this page's (template) code: 如何在另一个资源页面(称为“服务”)的右侧栏中,使用文章[[*description]][[*introtext]]创建文章预览(位于资源“文章”中 )模板)代码:

<html>
<head>
<title>[[++site_name]] - [[*pagetitle]]</title>
<base href="[[++site_url]]" />
</head>
<body>
[[*content]]

</body>
</html>

)

I created new tpl, called it "article_story" with this code: 我用以下代码创建了新的tpl,称为“ article_story”

<p><a href="[[++site_url]][[~[[+id]]]]">[[+pagetitle]]<br>
<img alt="[[+pagetitle]]" src="[[+tv.image:phpthumbof=`w=300`]]"></a><br>
[[+introtext]]<br>
</p>

I've tried to use this code: 我尝试使用以下代码:

[[!getResources? &parents=`[[*id]]` &tpl=`article_story` &limit=`3` &sortby=`{"publishedon":"ASC","createdon":"DESC"}`]] 

But it doesn't work. 但这是行不通的。 Any thoughts? 有什么想法吗?

By default the getResources Extra doesn't include unpublished Resources. 默认情况下, getResources Extra不包括未发布的资源。 You need to add &showUnpublished to the snippet call: 您需要将&showUnpublished添加到代码段调用中:

[[!getResources? 
    &parents=`[[*id]]` 
    &tpl=`article_story`
    &showUnpublished=`1` 
    &limit=`3` 
    &sortby=`{"publishedon":"ASC","createdon":"DESC"}`
]] 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM