分页不适用于表达式引擎中的 exp:search:search_results

发布于 2024-12-24 21:21:32 字数 1597 浏览 4 评论 0原文

分页链接在表达式引擎 exp:搜索结果上不起作用。单击分页链接时,页面不会显示新结果。

 {exp:search:total_results}</b>Result(s) for <b>{exp:search:keywords} 
      {exp:search:search_results entry_id={entry_id}  
        switch="#000000|#003300"  status="Open" 
        dynamic="off"  orderby="date" sort="desc"} 

    {exp:search:search_results switch="resultRowOne|resultRowTwo" paginate="bottom"    limit="2"}

        <?php $articlePath = "article";?>
        {related_entries id="article_feature"}

          {if title == "Bay Blog"}<?php $articlePath = "blog";?>  
        {/related_entries} 

          <b><a href="{title_permalink="/blog/"}">{title}</a></b> from <em>{related_entries id="article_feature"}{title} {/related_entries}</em><br/>
          {if:else}

          <b><a href="{title_permalink="/article/"}">{title}</a></b> from <em>{related_entries id="article_feature"}{title} {/related_entries}</em><br/>
          {/if}     

          {exp:trunchtml chars="250" inline="..."}
                  {article_body}
           {/exp:trunchtml}
           {related_entries id="article_issue"}
            <a href="/issue/{entry_id}"> [ {title}] </a> {/related_entries}
            <br><br>
          {if no_results}
            Sorry!, Search result found!
        {/if} 
   {/exp:search:search_results}
{paginate}
        <div class='paginate'>
            <span class='pagecount'>{page_count}</span>&nbsp;
        </div>
{paginate} 

Pagination link not working on expression engine exp:search results.Page does not display the new result when pagination link is clicked.

 {exp:search:total_results}</b>Result(s) for <b>{exp:search:keywords} 
      {exp:search:search_results entry_id={entry_id}  
        switch="#000000|#003300"  status="Open" 
        dynamic="off"  orderby="date" sort="desc"} 

    {exp:search:search_results switch="resultRowOne|resultRowTwo" paginate="bottom"    limit="2"}

        <?php $articlePath = "article";?>
        {related_entries id="article_feature"}

          {if title == "Bay Blog"}<?php $articlePath = "blog";?>  
        {/related_entries} 

          <b><a href="{title_permalink="/blog/"}">{title}</a></b> from <em>{related_entries id="article_feature"}{title} {/related_entries}</em><br/>
          {if:else}

          <b><a href="{title_permalink="/article/"}">{title}</a></b> from <em>{related_entries id="article_feature"}{title} {/related_entries}</em><br/>
          {/if}     

          {exp:trunchtml chars="250" inline="..."}
                  {article_body}
           {/exp:trunchtml}
           {related_entries id="article_issue"}
            <a href="/issue/{entry_id}"> [ {title}] </a> {/related_entries}
            <br><br>
          {if no_results}
            Sorry!, Search result found!
        {/if} 
   {/exp:search:search_results}
{paginate}
        <div class='paginate'>
            <span class='pagecount'>{page_count}</span> 
        </div>
{paginate} 

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

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

发布评论

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

评论(1

五里雾 2024-12-31 21:21:32

返回搜索结果时,使用auto_path<构建 URL 时的 /code> 变量:

<a href="{auto_path}">{title}</a>

与其他路径变量不同,此变量不需要指定模板组和模板名称。

相反,路径将自动由 搜索结果确定频道管理中频道的URL设置

管理员>渠道管理>频道>首选项:

常规频道首选项


如果您使用ExpressionEngine 的页面模块 或<要创建静态页面,以下用例可能对您也有帮助:

{if page_url == ""}
    // If the Search Result is a Dynamic Page
    <a href="{auto_path}">{title}</a>
{/if}

{if page_url != ""}
    // If the Search Result is a Static Page
    <a href="{page_url}">{title}</a>
{/if}

您还可以测试以查看从哪个渠道获取搜索结果并有条件地对其进行操作:

{if channel_name == "about"}
    <a href="{page_url}">{title}</a>
{if:else}
    <a href="{auto_path}">{title}</a>
{/if}

When returning search results, use the auto_path variable when building your URLs:

<a href="{auto_path}">{title}</a>

Unlike other path variables, this variable does not require the Template Group and Template Name to be specified.

Instead, the path will automatically be determined by the Search Results URL setting for the channel in Channel Management.

Admin > Channel Administration > Channels > Preferences:

General Channel Preferences


If you're using ExpressionEngine's Pages Module or Structure to create static pages, the following use case may be of help to you as well:

{if page_url == ""}
    // If the Search Result is a Dynamic Page
    <a href="{auto_path}">{title}</a>
{/if}

{if page_url != ""}
    // If the Search Result is a Static Page
    <a href="{page_url}">{title}</a>
{/if}

You can also test to see what channel the search result is being fetched from and act on it conditionally:

{if channel_name == "about"}
    <a href="{page_url}">{title}</a>
{if:else}
    <a href="{auto_path}">{title}</a>
{/if}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文