How to redirect search page liferay 6.2?

北城余情 提交于 2019-12-11 03:59:42

问题


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

In .../taglib/ui/search/start.jsp I have tried to change:

portletURL.setParameter("redirect", currentURL);

in

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

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


回答1:


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.

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);
}

And this is my HTML part of 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>

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.



来源:https://stackoverflow.com/questions/29344584/how-to-redirect-search-page-liferay-6-2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!