如何在 Expression Engine 搜索结果中获得准确的入口路径?

发布于 2024-11-27 18:05:28 字数 2914 浏览 1 评论 0原文

我正在努力在网站上实现高级搜索,并且需要一些帮助来获取搜索结果页面中条目的更准确路径。

我正在使用修改后的高级搜索表单:

    {exp:search:advanced_form result_page="search/advanced_results"} 
    <fieldset class="fieldset">
    <legend>{lang:search_by_keyword}</legend>
    <input type="text" class="input" maxlength="100" size="40" name="keywords" style="width:100%;" />
    <div class="default">
    <select name="search_in">
        <option value="titles" selected="selected">{lang:search_in_titles}</option>
        <option value="entries" selected="selected">{lang:search_in_entries}</option>
    </select>
    </div>
    <div class="default">
        <select name="where">
            <option value="exact" selected="selected">{lang:exact_phrase_match}</option>
            <option value="any">{lang:search_any_words}</option>
            <option value="all" >{lang:search_all_words}</option>
            <option value="word" >{lang:search_exact_word}</option>
        </select>
    </div>
</fieldset>

<div class="defaultBold">{lang:channels}</div>
    <select id="channel_id" name='channel_id[]' class='multiselect' size='15' multiple='multiple' onchange='changemenu(this.selectedIndex);'>
        {channel_names}
    </select>

<div class="defaultBold">{lang:categories}</div>
    <select name='cat_id[]' size='18' class='multiselect' multiple='multiple'>
        <option value='all' selected="selected">{lang:any_category}</option>
    </select>

<div class='searchSubmit'>
    <input type='submit' value='Search' class='submit' />
</div>
{/exp:search:advanced_form}
</body>

和标准搜索结果代码:

<table border="0" cellpadding="6" cellspacing="1" width="100%">
<tr>
<th>{lang:title}</th>
<th>{lang:excerpt}</th>
<th>{lang:author}</th>
<th>{lang:date}</th>
<th>{lang:total_comments}</th>
<th>{lang:recent_comments}</th>
</tr>

{exp:search:search_results switch="resultRowOne|resultRowTwo"}

<tr class="{switch}">
<td width="30%" valign="top"><b><a href="{auto_path}">{title}</a></b></td>
<td width="30%" valign="top">{excerpt}</td>
<td width="10%" valign="top"><a href="{member_path='member/index'}">{author}</a></td>
<td width="10%" valign="top">{entry_date format="%m/%d/%y"}</td>
<td width="10%" valign="top">{comment_total}</td>
<td width="10%" valign="top">{recent_comment_date format="%m/%d/%y"}</td>
</tr>

{/exp:search:search_results}

</table>

唯一的问题是 {auto_path} 一点也不准确,不链接到条目,并且基本上试图从主页上搭载。有没有办法确保更准确的路径?我知道 Google 搜索可以做到。

谢谢!

I am working to implement advanced search on a site and need some help getting more accurate paths to entries in the search results page.

I am using a modified advanced search form:

    {exp:search:advanced_form result_page="search/advanced_results"} 
    <fieldset class="fieldset">
    <legend>{lang:search_by_keyword}</legend>
    <input type="text" class="input" maxlength="100" size="40" name="keywords" style="width:100%;" />
    <div class="default">
    <select name="search_in">
        <option value="titles" selected="selected">{lang:search_in_titles}</option>
        <option value="entries" selected="selected">{lang:search_in_entries}</option>
    </select>
    </div>
    <div class="default">
        <select name="where">
            <option value="exact" selected="selected">{lang:exact_phrase_match}</option>
            <option value="any">{lang:search_any_words}</option>
            <option value="all" >{lang:search_all_words}</option>
            <option value="word" >{lang:search_exact_word}</option>
        </select>
    </div>
</fieldset>

<div class="defaultBold">{lang:channels}</div>
    <select id="channel_id" name='channel_id[]' class='multiselect' size='15' multiple='multiple' onchange='changemenu(this.selectedIndex);'>
        {channel_names}
    </select>

<div class="defaultBold">{lang:categories}</div>
    <select name='cat_id[]' size='18' class='multiselect' multiple='multiple'>
        <option value='all' selected="selected">{lang:any_category}</option>
    </select>

<div class='searchSubmit'>
    <input type='submit' value='Search' class='submit' />
</div>
{/exp:search:advanced_form}
</body>

and the standard search results code:

<table border="0" cellpadding="6" cellspacing="1" width="100%">
<tr>
<th>{lang:title}</th>
<th>{lang:excerpt}</th>
<th>{lang:author}</th>
<th>{lang:date}</th>
<th>{lang:total_comments}</th>
<th>{lang:recent_comments}</th>
</tr>

{exp:search:search_results switch="resultRowOne|resultRowTwo"}

<tr class="{switch}">
<td width="30%" valign="top"><b><a href="{auto_path}">{title}</a></b></td>
<td width="30%" valign="top">{excerpt}</td>
<td width="10%" valign="top"><a href="{member_path='member/index'}">{author}</a></td>
<td width="10%" valign="top">{entry_date format="%m/%d/%y"}</td>
<td width="10%" valign="top">{comment_total}</td>
<td width="10%" valign="top">{recent_comment_date format="%m/%d/%y"}</td>
</tr>

{/exp:search:search_results}

</table>

The only problem is that the {auto_path} is anything but accurate, does not link to the entry and basically tries to piggyback off the home page. Is there a way secure more accurate paths? I know Google Search can do it.

Thanks!

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

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

发布评论

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

评论(2

野鹿林 2024-12-04 18:05:28

管理→频道管理→频道→编辑首选项→路径设置。您可以在此处输入 auto_pathid_auto_path 的基本 URL。

因此,输入 /news/entry/ 将在搜索结果中产生 /news/entry/my-new-url-title

Admin → Channel Administration → Channels → Edit Preferences → Path Settings. There you enter the base URL for your auto_path or id_auto_path.

So entering /news/entry/ would yield /news/entry/my-new-url-title in your search results.

情丝乱 2024-12-04 18:05:28

搜索结果标记<中的 {auto_path} 变量/a> 由频道管理中频道的搜索结果 URL 首选项设置自动确定。

您可以在控制面板中找到此首选项:管理>渠道管理>频道偏好设置:在此处输入图像描述

The {auto_path} variable in the Search Results Tag is automatically be determined by the Search Results URL preference setting for the channel in Channel Management.

You can find this preference in the Control Panel at: Admin > Channel Administration > Channel Preferences:enter image description here

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