如何重定向搜索页面liferay 6.2? [英] How to redirect search page liferay 6.2?

查看:115
本文介绍了如何重定向搜索页面liferay 6.2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将search-Result(portlet:$theme.journalContentSearch())重定向到另一个我的页面(例如"/search")?

Is it possible to redirect search-Result (portlet: $theme.journalContentSearch() ) to another my page (example "/search")?

.../taglib/ui/search/start.jsp中 我试图改变:

portletURL.setParameter("redirect", currentURL);

portletURL.setParameter("redirect", "/results");

但是没有用.你有什么建议吗?谢谢.

But didn't work. Have you any suggestion? Thanks.

推荐答案

我知道,这是一个过时的问题.但是,今天我要做类似的任务 这是我的发现.

I know, this is an outdated question. But, today I had similar task to do and here are my findings.

不幸的是,没有任何配置选项可用于重定向和在所需页面上显示搜索结果.

Unfortunately, there isn't any configuration option available to redirect and show search results on desired page.

但是,我通过以下自定义jQuery hack解决了该问题:

However, I solved it with following custom jQuery hack:

if(jQuery('#p_p_id_77_') != null && jQuery('#p_p_id_77_').length > 0){
    var URL = jQuery('#p_p_id_77_').find('form').attr('action');

    var startURL = URL.substring(0, URL.lastIndexOf('/'));
    var middleURL = "/search";  // Page where you want to redirect and show search results
    var endURL = URL.substring(URL.indexOf('?'), URL.length);

    var finalURL = startURL + middleURL + endURL;
    jQuery('#p_p_id_77_').find('form').attr('action', finalURL);
}

这是我在portal_normal.vm

<div class="top-header-search">
    #set ($searchPortletId = "77")
    $velocityPortletPreferences.setValue("portlet-setup-show-borders", "false")
    #set($restoreRenderingPortletContent = $theme.runtime($searchPortletId, "", $velocityPortletPreferences.toString()))
    $restoreRenderingPortletContent
    $velocityPortletPreferences.reset()
</div>

我更喜欢使用$theme.runtime嵌入搜索portlet,因为我发现使用$theme.journalContentSearch()重定向部分可以正常工作,但是由于没有将标头字段的keyword传递给搜索结果字段,因此它返回了搜索中的所有内容

I preferred embedding search portlet using $theme.runtime, because I observed that using $theme.journalContentSearch() redirection part is working fine, but it is returning everything in search, as keyword of header field is not being passed to search results field.

这篇关于如何重定向搜索页面liferay 6.2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆