2012-01-04 40 views
0

這段代碼有什麼錯誤,它不允許我只顯示兩條記錄以及分頁,任何幫助高度讚賞?限制和分頁不能在表達式引擎中工作exp:查詢

{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}  

回答

0
{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} 
+0

問題是與ee解析的方式我從通道內部的sql部分,並添加之前打開頻道條目,它開始工作。 – user1123399 2012-01-05 20:57:31

0

您最外面的通道條目查詢限制數據集僅返回一個結果。

嘗試改變limit parameter

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

當使用pagination,極限參數確定每頁顯示的條目數。

+0

謝謝rjb。我不能使它限制=「2」,因爲搜索:entry_id =「{embed:entry_ids}返回一些值,我需要通過做限制=」1「只顯示問題是如果我使用常規選擇語句我的限制在exp :查詢的工作原理,但一些如何我的上面的SQL查詢與連接沒有限制=「2」在exp:query。 – user1123399 2012-01-05 13:09:28