当我向表达式引擎 URL 添加第三段时,exp:channel:entries 停止返回结果
我遇到一个问题,网址中的第三个“段”将导致 ALL exp:channel:entries 停止返回结果。
示例网址:
工作正常: siteurl.com/index.php/one/two
不起作用: siteurl.com/index.php/one/two/ Three
示例条目拉动:
{exp:channel:entrieschannel="my_channel"category="18"sort="asc"search:show_toggle="=SHOW"orderby="sort_order"}
这是我不知道的某种注入吗?我已经搜索过文档,据我所知,我的类别规范应该覆盖 url 中的任何内容。我可能搞砸了,但我必须做点什么。 我可以在频道模块中修改什么吗?
I'm having an issue where a third "segment" in the url will cause ALL the exp:channel:entries to stop returning results.
Example URLs:
works fine: siteurl.com/index.php/one/two
does not work: siteurl.com/index.php/one/two/three
Example Entry Pull:
{exp:channel:entries channel="my_channel" category="18" sort="asc" search:show_toggle="=SHOW" orderby="sort_order"}
Is this some kind of injection that I am unaware of. I have searched through the documentation, and from what I can tell my specification of a category should overwrite anything in the url. I may be botching it up, but there HAS to be something I can do.?
Something I can modify in the channel module?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不使用 dynamic 标记参数频道条目标签,ExpressionEngine期望 URL 段变量包含条目的条目 ID 或URL 标题。
由于第三个 URL 段
/index.php/one/two/third
不是数字条目 ID 或 URL 标题,因此您的频道条目查询不包含任何信息。由于您已经编写了极其具体的频道条目查询,因此请务必将
dynamic="no"
添加到您的{exp:channel:entries}
标记循环让 ExpressionEngine忽略 URL 段,而是使用您提供的参数:此外,通过添加一个简单的 条件变量到您的代码中,当没有结果时您将能够看到一条消息返回:
了解基本的 ExpressionEngine 的 URL 概念和URL 分段对于理解和解决此类问题非常重要。
Without using the dynamic tag parameter in your Channel Entries tag, ExpressionEngine is expecting a URL Segment Variable to contain the Entry ID or URL Title of your entry.
Since the third URL Segment
/index.php/one/two/three
isn't a numeric Entry ID or URL Title, your Channel Entries query doesn't contain any information.Since you've written an extremely specific Channel Entries Query, be sure to add
dynamic="no"
to your{exp:channel:entries}
tag loop to have ExpressionEngine ignore the URL Segments and instead use the parameters you supply:Furthermore, by adding a simple Conditional Variable to your code, you will be able to see a message when no results are returned:
Grokking the fundamental ExpressionEngine's URL concepts and URL Segments is important to understanding and troubleshooting issues like this.
ExpressionEngine 按以下方式查看 /index.php/ 后面的段:
因此,您的情况,EE 正在寻找加载one 模板组中的 two 模板,然后显示 ID 为 的类别中 my_channel 渠道中的条目18 并且 url_title 为三。
您对类别的指定只会覆盖 URL 中的任何类别信息。 (例如,/template_group/template/category/doorstops 或 /template_group/template/C10 不会影响示例中显示的条目)。
如果您希望您的
{exp:channel:entries}
标记完全忽略 URL(分页除外),您可以将dynamic="off"
添加到您的标记参数。ExpressionEngine looks at the segments which follow /index.php/ as the following:
So, in your case, EE is looking to load the two template, from the one template group, and then display the entry from the my_channel channel that's in the category with the ID of 18 and has a url_title of three.
Your specification of the category only overwrites any category information in the URL. (e.g., /template_group/template/category/doorstops or /template_group/template/C10 would not affect which entries get displayed in your example).
If you want your
{exp:channel:entries}
tag to ignore the URL completely (with the exception of pagination), you can adddynamic="off"
to your tag parameters.