苏禄:如何实现"load more"智能内容的按钮?



所以我这样定义我的字段:

<property name="news" type="smart_content">
<!-- @see https://docs.sulu.io/en/2.2/reference/content-types/smart_content.html -->
<meta>
<title lang="en">News</title>
<title lang="de">Nachrichten</title>
</meta>
<params>
<param name="provider" value="articles"/>
<param name="types" value="news"/>
</params>
</property>

我的树枝模板看起来像:

<div>
{% for article in news %}
<a href="{{ sulu_content_path(article.routePath) }}" >
<h2>
{{ article.excerpt.title|default(article.title) }}
</h2>
</a>
{% endfor %}
</div>

它抓取";"新闻";类型,效果很好。现在我需要实现";加载更多";一种寻呼机。所以我应该在一开始就展示,即5篇最新的文章,并对它们进行咆哮;加载更多";按钮,单击时应加载另一个5,单击时再次加载另一5,依此类推,直到有可用的新闻文章为止。我在苏鲁的文件中没有看到";加载更多";提到了该功能。

实现这一目标的最佳方式是什么?

我不久前创建了一个github概要,展示了它的工作原理。看见https://gist.github.com/luca-rath/d16c0ad74fa06da49fed22404a53398b

最新更新