我的客户有一个名为home_2017
的频道,其中一个频道字段为home_profile
。该通道字段的类型为grid
。在网格中,有一个名为entry
的字段(除其他外),其数据类型为Relationships
,因为它链接到另一个称为Profiles
的通道。该代码库使用的是EE 2。
我是ExpressionEngine的新手,我想做的是通过关系使页面显示Profiles
的单个 random 条目。在用户界面中,我仅在Entry Title
下拉菜单中看到Entry Date
和Order By
的选项(参见图片)。
代码看起来像这样:
{home_profile limit="1"}
{home_profile:entry}
<div>
<div>
<h2>Profile</h2>
<h3>{home_profile:headline}</h3>
<p>{home_profile:text}</p>
<a href="{home_profile:entry:page_url}">{home_profile:button_label}</a>
</div>
</div>
{/home_profile:entry}
{/home_profile}
limit="1"
参数工作正常,但是如果我添加orderby="random"
,则没有任何变化。我也尝试过在home_profile:entry
之后添加随机参数,但没有成功。有没有办法让我通过EE2中的此关系字段随机抽取这些条目,还是我必须找到一种不同的编码方式来获得想要的功能?我在这里处理别人的遗留代码库。我确定你知道那是怎么回事。