所以,我已经搜索过,发现了一些可以让我得到我想要的帖子,但它仍然不太有效。这篇文章似乎最接近我想要实现的目标,我以此为基础构建了我的代码:http ://expressionengine.com/forums/viewthread/168142/
解释; 我有一系列条目,每个条目只分配给一个类别。我想列出这些类别,并在每个类别下,列出具有其中一个自定义字段的条目。像这样:
第一类
- 项目 1
- 第 2 项
第 2 类
- 项目 1
- 第 2 项
所以,这是我现在的代码,它列出了类别,但根本没有吐出任何条目:
{exp:channel:categories channel="faq-question" style="linear"}
<section class="faq-category-container closed">
<h1 class="faq-category-header"><a href="#">{category_name}</a></h1>
<dl>
{exp:query sql="
SELECT title, url_title AS urlt, cat_id
FROM exp_channel_titles
NATURAL JOIN exp_category_posts
WHERE channel_id = '7' AND cat_id = '{category_id}'
ORDER BY title ASC"
}
{embed="jazz-camp/faq-cat-list" faqlink="{urlt}"}
{/exp:query}
</dl>
</section><!-- end .faq-category -->
{/exp:channel:categories}
以及它引用的嵌入式模板:
{exp:channel:entries channel="faq-question" url_title="{embed:faqlink}"}<!-- entry -->
<dt>{title}</dt>
<dd>
{faq_content}
</dd>
{/exp:channel:entries}
非常感激任何的帮助!