Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Yannick Ongena
Adding portlet to a theme
February 28, 2010 12:21 PM
Answer

Yannick Ongena

Rank: Junior Member

Posts: 26

Join Date: February 22, 2010

Recent Posts

Is it possible to add a portlet to a custom theme?
For example i have a custom menu portlet with specific items based upon the user and some kind of data.
It is build in a portlet but currently i add this manually to each page.
Is is possible to add this in the template so i won't need to add this on each page?
Corné Aussems
RE: Adding portlet to a theme
February 28, 2010 1:47 PM
Answer

Corné Aussems

Rank: Liferay Legend

Posts: 1270

Join Date: October 3, 2006

Recent Posts

Try

1$theme.runtime("YOUR_PORTLET_ID", "", $velocityPortletPreferences.toString())
2
3or
4
5<div align="right" class="login">
6$theme.runtime("58")
7</div>


Greetings,
Corné
Erik Andersson
RE: Adding portlet to a theme
March 18, 2010 4:46 AM
Answer

Erik Andersson

Rank: Junior Member

Posts: 38

Join Date: April 8, 2008

Recent Posts

Hi Yannick,

If you have a custom portlet (i.e. not one of the core Liferay portlets), you must also add some information about which WAR file the portlet resides in when including a static portlet.

1. To include a core Liferay portlet that is NOT instancable - do as Corné proposes

2. To include a core Liferay portlet that IS instancable - add an instance reference to the run time:

1$theme.runtime("56_INSTANCE_qyqy", "", $velocityPortletPreferences.toString())


3. To include a custom portlet with portlet id "myportlet" that is deployed in the plugin "myplugin":
1$theme.runtime("myportlet_WAR_myplugin", "", $velocityPortletPreferences.toString())


4. The velocity preferences can be used for example to remove the portlet borders:
1$velocityPortletPreferences.setValue("portlet-setup-show-borders", "false")
2$theme.runtime("56_INSTANCE_qyqy", "", $velocityPortletPreferences.toString())


Cheers,
Erik
Anonymous
RE: Adding portlet to a theme
March 22, 2010 1:52 AM
Answer

Anonymous

Hi Yannick Ongena,

<div id="sample Portlet">
$velocityPortletPreferences.setValue("portlet-setup-show-borders", "false")
$theme.runtime("search_WAR_searchportlet_INSTANCE_gIT7", "", $velocityPortletPreferences.toString())
</div>

Note:

search_WAR_searchportlet_INSTANCE_gIT7

Here search is the portlet name.
gIT7 is the hard coded instance.
Example for adding plugin portlet to the theme.

It Will Work.
For any help please feel free to contact us.

Thanks in Advance,
V.C.Vijayan
Senior Software Developer, TransIT mPower Labs (P) Ltd.
info@mpowerglobal.com
mPower Global Inc.
A Liferay expert company.
Amira princesse
RE: Adding portlet to a theme
April 12, 2011 9:24 AM
Answer

Amira princesse

Rank: New Member

Posts: 8

Join Date: January 4, 2010

Recent Posts

hello evry body,

i've created a custom search portlet that I wish to includ in the top of the theme.


this is the VM code
 1
 2<div class="search_input">
 3
 4#set ($myPlaceURL = $portletURLFactory.create($request, "customsearch_WAR_CustomSearchportlet_INSTANCE_abcd", $getterUtil.getLong($plid), "RENDER_PHASE"))
 5
 6${myPlaceURL.setWindowState("maximized")}
 7${myPlaceURL.setPortletMode("view")}
 8${myPlaceURL.setParameter("javax.portlet.action", "doSearch")}
 9
10<form action="${myPlaceURL.toString()}" method="post" id="customsearch_WAR_CustomSearchportlet_INSTANCE_abcd_fm" > 
11    <input type="text" name="customsearch_WAR_CustomSearchportlet_INSTANCE_abcd_search"  id="customsearch_WAR_CustomSearchportlet_INSTANCE_abcd_search"/>
12    <input type="submit" value="Search" type="submit" /> 
13       
14</form>   
15
16
17</div>


and when click on the search buttom of my portlet I get :

You do not have the roles required to access this portlet.


note : i do not get any exceptio in my log

could any of you help me plz

Regards,
Amira
Brian Scott Schupbach
RE: Adding portlet to a theme
September 7, 2011 9:01 AM
Answer

Brian Scott Schupbach

Rank: Expert

Posts: 329

Join Date: October 23, 2008

Recent Posts

I'm also getting the "you do not have the required roles to access this portlet" error. Its weird because I'm logged in as the administrator and should have access to everything. Any ideas?
Jesse Paria
RE: Adding portlet to a theme
January 19, 2012 11:30 AM
Answer

Jesse Paria

Rank: Junior Member

Posts: 69

Join Date: March 4, 2011

Recent Posts

Not sure about this but I think if you go into the control panel and select plugins configuration and then select portlet plugins. You can add and edit the roles for that plugin. Perhaps you don't have administrator role applied to that plugin. Seems strange but I suppose it is possible.
The other thing to check is what roles you have specified in the portlet itselt in the portlet.xml file.

Hope this helps