限制和分页在表达式引擎 exp:query 中不起作用

发布于 2024-12-25 10:25:53 字数 1426 浏览 5 评论 0原文

这段代码有什么问题,不允许我只显示两条记录以及分页,有任何帮助值得高度赞赏吗?

{exp:channel:entries channel="article" status="open" orderby="date" sort="desc" 
 search:entry_id="{embed:entry_ids}"  dynamic="off"  limit="1" paginate="bottom"}

        {exp:query  limit="1" sql="select count(*) as recordcount  from exp_channel_data a where entry_id IN ({embed:entry_ids}) AND channel_id=8"}
             <b> {recordcount} </b> articles found for:<b> {embed:author_name} </b>
        {/exp:query}
        <br />

        {exp:query limit="2" sql="Select B.field_id_29 as article_bodysubtitle,B.field_id_27 as bodytext, B.field_id_88 as iss_rel_id, D.title as articletitle, D.url_title as ut from exp_channel_data as B INNER JOIN exp_channel_titles D ON B.entry_id=D.entry_id where B.channel_id=8 AND B.entry_id IN({embed:entry_ids})"}
            <br />
            <strong><a href="{path='article/index/{ut}'}">{articletitle}</a></strong>:
            {exp:trunchtml chars="250" inline="..."}
              {bodytext}
               <br />                        
           {/exp:trunchtml}
           <br />

          {embed="backissues/embed_iss" iss_rel_id="{iss_rel_id}"}
          <br /><br />
{paginate}
<p>Page {current_page} of {total_pages} pages {pagination_links}</p>
{/paginate}

  {/exp:query}

{/exp:channel:entries}    

What is wrong in this code that is not allowing me to show only two records along with pagination any help highly appreciated?

{exp:channel:entries channel="article" status="open" orderby="date" sort="desc" 
 search:entry_id="{embed:entry_ids}"  dynamic="off"  limit="1" paginate="bottom"}

        {exp:query  limit="1" sql="select count(*) as recordcount  from exp_channel_data a where entry_id IN ({embed:entry_ids}) AND channel_id=8"}
             <b> {recordcount} </b> articles found for:<b> {embed:author_name} </b>
        {/exp:query}
        <br />

        {exp:query limit="2" sql="Select B.field_id_29 as article_bodysubtitle,B.field_id_27 as bodytext, B.field_id_88 as iss_rel_id, D.title as articletitle, D.url_title as ut from exp_channel_data as B INNER JOIN exp_channel_titles D ON B.entry_id=D.entry_id where B.channel_id=8 AND B.entry_id IN({embed:entry_ids})"}
            <br />
            <strong><a href="{path='article/index/{ut}'}">{articletitle}</a></strong>:
            {exp:trunchtml chars="250" inline="..."}
              {bodytext}
               <br />                        
           {/exp:trunchtml}
           <br />

          {embed="backissues/embed_iss" iss_rel_id="{iss_rel_id}"}
          <br /><br />
{paginate}
<p>Page {current_page} of {total_pages} pages {pagination_links}</p>
{/paginate}

  {/exp:query}

{/exp:channel:entries}    

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

瑾兮 2025-01-01 10:25:53

您最外层的通道条目查询将数据集限制为仅返回一个结果。

尝试更改限制参数

{exp:channel:entries ... limit="2" paginate="bottom"}

当使用pagination,limit参数决定每页显示的条目数。

Your outer-most channel entries query is restricting the data set to return only one result.

Try changing the limit parameter:

{exp:channel:entries ... limit="2" paginate="bottom"}

When using pagination, the limit parameter determines the number of entries shown per page.

萌面超妹 2025-01-01 10:25:53
{exp:query  limit="2" paginate="bottom"  sql="Select B.field_id_29 as article_bodysubtitle,B.field_id_27 as bodytext, B.field_id_88 as iss_rel_id, D.title as articletitle, D.url_title as ut
      from exp_channel_data as B
      INNER JOIN exp_channel_titles D ON B.entry_id=D.entry_id 
      where B.channel_id=8 
      AND B.entry_id IN({embed:entry_ids})"}

      {paginate}
         <p>Page {current_page} of {total_pages} pages {pagination_links}</p>
      {/paginate}

  {exp:channel:entries channel="article" status="open" orderby="date" sort="desc" 
    search:entry_id="{embed:entry_ids}"  dynamic="off" limit="1" }

    <strong><a href="{path='article/index/{ut}'}">{articletitle}</a></strong>:
        {exp:trunchtml chars="250" inline="..."}
          {bodytext}
           <br />
        {/exp:trunchtml}
       <br />
      {embed="backissues/embed_iss" iss_rel_id="{iss_rel_id}"}
      <br /><br />

  {/exp:channel:entries}
{/exp:query}
{exp:query  limit="2" paginate="bottom"  sql="Select B.field_id_29 as article_bodysubtitle,B.field_id_27 as bodytext, B.field_id_88 as iss_rel_id, D.title as articletitle, D.url_title as ut
      from exp_channel_data as B
      INNER JOIN exp_channel_titles D ON B.entry_id=D.entry_id 
      where B.channel_id=8 
      AND B.entry_id IN({embed:entry_ids})"}

      {paginate}
         <p>Page {current_page} of {total_pages} pages {pagination_links}</p>
      {/paginate}

  {exp:channel:entries channel="article" status="open" orderby="date" sort="desc" 
    search:entry_id="{embed:entry_ids}"  dynamic="off" limit="1" }

    <strong><a href="{path='article/index/{ut}'}">{articletitle}</a></strong>:
        {exp:trunchtml chars="250" inline="..."}
          {bodytext}
           <br />
        {/exp:trunchtml}
       <br />
      {embed="backissues/embed_iss" iss_rel_id="{iss_rel_id}"}
      <br /><br />

  {/exp:channel:entries}
{/exp:query}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文