07 March, 2013

Embed search in theme and redirect

As we know that we can simply embed search in theme which is mentioned in  http://www.liferaysolution.com/2011/12/embed-search-and-web-content-search.html

But If you want to embed search in theme and want to redirect on specific fix community page then you may need some modification and can use below code in you theme .vm file :



#set ($layoutService = $serviceLocator.findService('com.liferay.portal.service.LayoutLocalService') )
#set ($selectedPageGroup = $groupLocalService.getGroup($themeDisplay.getCompanyId(),"Guest") )
#set($pageLayout=$layoutService.getFriendlyURLLayout($selectedPageGroup.getGroupId(),false,"/search"))
#set($plid=$pageLayout.getPlid())
#set ($my_sites_portlet_url = $portletURLFactory.create($request, "3", $plid, "RENDER_PHASE"))
               
<div id="search">
          <form onsubmit="ctem_3_search(); return false;" name="ctem_3_fm" method="get" action="$my_sites_portlet_url">
                    <input type="hidden" value="maximized" name="p_p_state">
                    <input type="hidden" value="view" name="p_p_mode">
                    <input type="hidden" value="/search/search" name="_3_struts_action">
                    <input type="hidden" value="$themeDisplay.getURLCurrent()" name="_3_redirect">
                    <input type="hidden" value="0" name="_3_groupId">
                    <input type="text" value="" placeholder="I'm Looking for..." size="30" name="_3_keywords" class="">
                   
                    <input type="image" border="0" align="absmiddle" title="Search" src="/iu-health-theme/images/custom/ui/background/background-header-search-button.png">
      </form>
 </div>
         

Rate Me:

Liferay 7.3 compatibility matrix

Compatibility Matrix Liferay's general policy is to test Liferay Portal CE against newer major releases of operating systems, open s...