我写了一个简单的插件,基本上循环遍历一堆条目.该插件仅用于显示包含特征图像的条目,以及其他一些小的逻辑条件.我的标签的使用看起来像这样:
{exp:myentries:withimages channel="mychannel"}
<!-- This works fine -->
<h1>{title}</h1>
<!-- But nested exp:... tags don't seem to parse? -->
<p>{exp:ce_img:single src="feature_image"}</p>
{/exp:myentries:withimages}
Run Code Online (Sandbox Code Playgroud)
我在打电话
return $this->EE->TMPL->parse_variables($this->EE->TMPL->tagdata, $data);
Run Code Online (Sandbox Code Playgroud)
从我的自定义EE插件,数据就在那里,但只有嵌套的{exp:...标签不想解析.
我已经按照在线用户指南尽可能接近地创建了插件,但是我需要一些帮助才能解析其他标签?如果我只输出{feature_image},该字段将按预期呈现图像的src值.
任何人都可以对我做错的事情有所了解吗?
您希望在{exp:myentries:withimages标记中放置parse ="inward"参数,否则模板将尝试在设置{feature_image}之前解析exp:ce_img调用.
{exp:myentries:withimages parse="inward" channel="mychannel"}
Run Code Online (Sandbox Code Playgroud)
parse ="inward"将告诉EE在解析标记对中的任何其他标记之前首先运行此标记.