掲示板

How to include portlet or content to my theme's layout?

16年前 に Toni Juhani Aho によって更新されました。

How to include portlet or content to my theme's layout?

New Member 投稿: 13 参加年月日: 07/09/21 最新の投稿
Hi!
I've created my custom theme which includes 3 columns in layout ( | | ). My problem is, how can I include "content" to my theme's layout that content would be part of my theme. For example, i need to include navigation bar in my left column. I've created my theme by customizing classic theme (vm). Do I need to include something to $layout, $page -variables editing init_custom.vm?
16年前 に atul patel によって更新されました。

RE: How to include portlet or content to my theme's layout?

Regular Member 投稿: 192 参加年月日: 06/11/18 最新の投稿
To answer your question it depends.

If your 3 column layout is a layout template and you want the navigation in the first column you have 2 options.

1. Add the navigaiton porlet to the first column (tedious). of if this theme is for a specific community, you can automate this via portal.properties. I've included a portion of the file at the bottom of this msg.
2. If running 4.3.2 and you would like to define this layout to always include the nav portlet then you can do this in your layoutpl.

This is a portion of one of my templates. It includes the navgiation portlet, sets some default styles on it. Notice I do not include the processor because I didn't want users to add content here. I also changed the column-id to be consistent.

Hope this helps

<td class="lfr-column " id="column-nav" valign="top">
$velocityPortletPreferences.setValue("portlet-setup-show-borders", "false")
$velocityPortletPreferences.setValue("root-layout-type", "absolute")
$velocityPortletPreferences.setValue("bullet-style", "main")
$velocityPortletPreferences.setValue("header-type", "none")
$velocityPortletPreferences.setValue("root-layout-level", "0")
$velocityPortletPreferences.setValue("included-layouts", "all")
$velocityPortletPreferences.setValue("display-style", "[custom]")
$theme.runtime("71_INSTANCE_MAIN", "", $velocityPortletPreferences.toString())
$velocityPortletPreferences.reset()

</td>



#
# Specify static portlets that cannot be moved and will always appear on
# every layout. Static portlets will take precedence over portlets that may
# have been dynamically configured for the layout.
#
# For example, if you want the Hello World portlet to always appear at the
# start of the iteration of the first column for user layouts, set the
# property "layout.static.portlets.start.column-1[user]" to "47". If you
# want the Hello World portlet to always appear at the end of the second
# column for user layouts, set the property
# "layout.static.portlets.end.column-2[user]" to "47". You can input a
# list of comma delimited portlet ids to specify more than one portlet. If
# the portlet is instanceable, add the suffix "_INSTANCE_abcd" to the
# portlet id, where "abcd" is any random alphanumeric string.
#
# The static portlets are fetched based on the properties controlled by
# custom filters using EasyConf. By default, the available filters are
# user, community, and organization.
#
#layout.static.portlets.start.column-1[user]=3,6
#layout.static.portlets.end.column-1[user]=14
#layout.static.portlets.start.column-2[user]=71_INSTANCE_abcd,7
#layout.static.portlets.end.column-2[user]=34,70
#layout.static.portlets.start.column-3[user]=
#layout.static.portlets.end.column-3[user]=

#
# It is also possible to add a static portlet which only shows in the first
# layout of a user or community.
#
#layout.static.portlets.start.column-1[user][firstLayout]=3,6
#layout.static.portlets.end.column-2[community][firstLayout]=14

#
# Set the static layouts for community layouts.
#
#layout.static.portlets.start.column-1[community]=
#layout.static.portlets.end.column-1[community]=
#layout.static.portlets.start.column-2[community]=
#layout.static.portlets.end.column-2[community]=
#layout.static.portlets.start.column-3[community]=
#layout.static.portlets.end.column-3[community]=

#
# Set the static layouts for organization layouts.
#
#layout.static.portlets.start.column-1[organization]=
#layout.static.portlets.end.column-1[organization]=
#layout.static.portlets.start.column-2[organization]=
#layout.static.portlets.end.column-2[organization]=
#layout.static.portlets.start.column-3[organization]=
#layout.static.portlets.end.column-3[organization]=
16年前 に Toni Juhani Aho によって更新されました。

RE: How to include portlet or content to my theme's layout?

New Member 投稿: 13 参加年月日: 07/09/21 最新の投稿
Thanks, it really helped me to attach navigation bar to layout...but is there ANY chance to use navigation bar just for the spesific theme.

i've tried to edit portal-ext.properties like this:

"theme-name".layout.static.portlets.start.column-1=71_INSTANCE_cQwb

no help.

Also default settings of navigation portlet resets every time in subpages, so navigation portlet settings didn't follow to subpages.

I'm using liferay bundle 4.3.1 with tomcat and MySQL database.
16年前 に atul patel によって更新されました。

RE: How to include portlet or content to my theme's layout?

Regular Member 投稿: 192 参加年月日: 06/11/18 最新の投稿
Because I couldn't control when, where, and with what configuraton, I chose to go the modify layout route.

I'll have to say I did not find a solution I liked. But I did find one. I'm not happy with this because I can't restrict the layout to only be used by the theme. However depending on your environment, that may or may not work for you.

The solution was the following layout template. Hopefully this will save you many hours.

<div class="vertnav-2col" id="content-wrapper">
<table id="layout-grid">
<tr>
<td class="lfr-column " id="column-nav" valign="top">
$velocityPortletPreferences.setValue("portlet-setup-show-borders", "false")
$velocityPortletPreferences.setValue("root-layout-type", "absolute")
$velocityPortletPreferences.setValue("bullet-style", "main")
$velocityPortletPreferences.setValue("header-type", "none")
$velocityPortletPreferences.setValue("root-layout-level", "0")
$velocityPortletPreferences.setValue("included-layouts", "all")
$velocityPortletPreferences.setValue("display-style", "[custom]")
$theme.runtime("71_INSTANCE_MAIN", "", $velocityPortletPreferences.toString())
$velocityPortletPreferences.reset()

</td>
<td valign="top">
<table>
<tr><td class="lfr-column" id="column-3" colspan="2">
$velocityPortletPreferences.setValue("portlet-setup-show-borders", "false")
$theme.runtime("73_INSTANCE_bcbc", "", $velocityPortletPreferences.toString())
$velocityPortletPreferences.reset()
</td></tr>
<tr>
<td class="lfr-column " id="column-1" valign="top">
$processor.processColumn("column-1")
</td>
<td class="lfr-column " id="column-2" valign="top">
$processor.processColumn("column-2")
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>



Come to think of it, you could modify an exiting layout to include this logic but then also add an if.... I'm not sure if this is the exact syntax but the logic should hold

#set ($theme_settings = $themeDisplay.getTheme().getSettings())
#set ($injectMenu = $theme_settings.getProperty("injectMenu"))
#if ($injectMenu > 1)
...
$theme.runtime("71_INSTANCE_NAV1", "", $velocityPortletPreferences.toString())
...
#end


and in your theme's look and feel.exl you would have:

<settings>
<setting key="injectMenu" value="1" />
</settings>
16年前 に Toni Juhani Aho によって更新されました。

RE: How to include portlet or content to my theme's layout?

New Member 投稿: 13 参加年月日: 07/09/21 最新の投稿
Thanks, i made the changes to layoutpl, and it worked now.

But still i've got one problem. How can i remove "navigation"-title from my navigation portlet. I've tried next settings with no help:

$velocityPortletPreferences.setValue("custom-title", "")
$velocityPortletPreferences.setValue("title", "")
$velocityPortletPreferences.setValue("portlet-title", "")

But what are the right settings that affect navigation portlet title?
16年前 に atul patel によって更新されました。

RE: How to include portlet or content to my theme's layout?

Regular Member 投稿: 192 参加年月日: 06/11/18 最新の投稿
Hi Toni.

If you just copy the settings from my original reply you would should be fine... I've added some comments below that you should remove.

$velocityPortletPreferences.setValue("portlet-setup-show-borders", "false") <-- hides borders/title
$velocityPortletPreferences.setValue("root-layout-type", "absolute") <-- relative or absolute
$velocityPortletPreferences.setValue("root-layout-level", "0")
$velocityPortletPreferences.setValue("bullet-style", "main") <-- used with css to handle styling
$velocityPortletPreferences.setValue("header-type", "none") <-- show a header?
$velocityPortletPreferences.setValue("included-layouts", "all") <-- is you have drill down submenus use all
$velocityPortletPreferences.setValue("display-style", "[custom]")
$theme.runtime("71_INSTANCE_MAIN", "", $velocityPortletPreferences.toString())
$velocityPortletPreferences.reset()
thumbnail
16年前 に Reinier de Graaf によって更新されました。

RE: How to include portlet or content to my theme's layout?

New Member 投稿: 15 参加年月日: 07/10/25 最新の投稿
Hello,

I have added an RSS portlet into our theme:
			$velocityPortletPreferences.setValue("urls", "$company_url/c/blogs/rss?p_l_id=11009&amp;groupId=10098")
			$velocityPortletPreferences.setValue("items-per-channel", "5")

			$theme.runtime("39_INSTANCE_RM01", "", $velocityPortletPreferences.toString()) ## rss portlet
			
			$velocityPortletPreferences.reset()

It is not a very good solution, but it is good enough for the time being.
As you can see in the code, I have set a RSS url and the items shown by the RSS portlet.
What I also want to push with my template:
  • Custom title of the portlet: "RSS" change to "News"
  • Change the title of the RSS feed, default the title is: "Guest"


Another problem is that guests get the message: "You do not have the roles required to access this portlet." Even after I have set View permission for Guest in Portlet Permissions for RSS in Enterprise Admin.

Ideas anyone?

Thank you in advance,

Reinier
16年前 に Trollbahrt Wunderlich によって更新されました。

RE: How to include portlet or content to my theme's layout?

Junior Member 投稿: 70 参加年月日: 07/06/11 最新の投稿
Reinier de Graaf:
Another problem is that guests get the message: "You do not have the roles required to access this portlet." Even after I have set View permission for Guest in Portlet Permissions for RSS in Enterprise Admin.


This you can solve in portal-ext.properties: enter the following line
layout.show.portlet.access.denied=false

and your portlet would not be shown, if the user has no rights to access them emoticon

Best
Troll
thumbnail
16年前 に Fuad Efendi によって更新されました。

RE: How to include portlet or content to my theme's layout?

Regular Member 投稿: 180 参加年月日: 07/04/05 最新の投稿
This simply does not work with SVN trunk version 10964:
$theme.runtime("39_INSTANCE_RM01", "", $velocityPortletPreferences.toString())
- it does nothing...

I have another question, Journal Content Search portlet can instanciate Journal Content which is wrongly formatted (because I need 1-column layout for it).

How to set 1-column layout for a theme?
thumbnail
13年前 に amira princesse によって更新されました。

RE: How to include portlet or content to my theme's layout?

New Member 投稿: 7 参加年月日: 10/01/04 最新の投稿
I have also the same problème

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


this is the VM code

<div class="search_input">

#set ($myPlaceURL = $portletURLFactory.create($request, "customsearch_WAR_CustomSearchportlet_INSTANCE_abcd", $getterUtil.getLong($plid), "RENDER_PHASE"))

${myPlaceURL.setWindowState("maximized")}
${myPlaceURL.setPortletMode("view")}
${myPlaceURL.setParameter("javax.portlet.action", "doSearch")}

<form action="${myPlaceURL.toString()}" method="post" id="customsearch_WAR_CustomSearchportlet_INSTANCE_abcd_fm">  
	<input type="text" name="customsearch_WAR_CustomSearchportlet_INSTANCE_abcd_search" id="customsearch_WAR_CustomSearchportlet_INSTANCE_abcd_search">
	<input type="submit" value="Search">  
		
</form>	


</div>



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

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


could any of you help me plz
thumbnail
11年前 に Peter Mesotten によって更新されました。

RE: How to include portlet or content to my theme's layout?

Junior Member 投稿: 45 参加年月日: 09/02/04 最新の投稿
Add the following entry to liferay-portlet.xml:

<add-default-resource>true</add-default-resource>
thumbnail
9年前 に Tariqul Islam によって更新されました。

RE: How to include portlet or content to my theme's layout?

New Member 投稿: 15 参加年月日: 13/01/27 最新の投稿