【问题标题】:URL title to Entry ID on Channel Entries tag频道条目标签上条目 ID 的 URL 标题
【发布时间】:2013-05-03 01:44:39
【问题描述】:

我正在尝试使用“条目 ID 的 URL 标题”插件将 entry_id 参数输入到频道条目标记中,但无法找到在模板解析顺序中足够早地插入 ID 信息的方法.

这不起作用 - 它不获取条目 ID,因此显示所有条目:

{exp:channel:entries entry_id="{exp:url_title_to_entry_id parse="inward" url_title="{last_segment}"}" dynamic="no"}
{title}
{/exp:channel:entries}

任何建议将不胜感激。

【问题讨论】:

标签: expressionengine


【解决方案1】:

你不能将一个函数标签作为另一个函数标签的参数。

因此,要么您必须将 {exp:url_title_to_entry_id} 结果作为嵌入变量传递给另一个包含 channel:entries 标签的模板,要么您必须使用标签对,以便一个函数标签包装另一个函数标签并使用变量.

url_title_to_entry_id 不允许标签对,所以要么使用嵌入技术,要么使用其他插件。

但是,你根本不需要插件...

{exp:channel:entries url_title="{last_segment}" dynamic="no"}
   {title}
{/exp:channel:entries}

reference.

我还建议添加 required_entry="yes" 和 limit="1" 然后在里面添加 {if no_results}...{/if} 条件。如果找不到匹配项,这将阻止它输出所有条目。

【讨论】:

    猜你喜欢
    • 2012-08-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-10
    相关资源
    最近更新 更多