Foren

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

Toni Juhani Aho, geändert vor 16 Jahren.

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

New Member Beiträge: 13 Beitrittsdatum: 21.09.07 Neueste Beiträge
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?
atul patel, geändert vor 16 Jahren.

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

Regular Member Beiträge: 192 Beitrittsdatum: 18.11.06 Neueste Beiträge
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]=
Toni Juhani Aho, geändert vor 16 Jahren.

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

New Member Beiträge: 13 Beitrittsdatum: 21.09.07 Neueste Beiträge
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.
atul patel, geändert vor 16 Jahren.

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

Regular Member Beiträge: 192 Beitrittsdatum: 18.11.06 Neueste Beiträge
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>
Toni Juhani Aho, geändert vor 16 Jahren.

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

New Member Beiträge: 13 Beitrittsdatum: 21.09.07 Neueste Beiträge
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?
atul patel, geändert vor 16 Jahren.

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

Regular Member Beiträge: 192 Beitrittsdatum: 18.11.06 Neueste Beiträge
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
Reinier de Graaf, geändert vor 16 Jahren.

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

New Member Beiträge: 15 Beitrittsdatum: 25.10.07 Neueste Beiträge
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
Trollbahrt Wunderlich, geändert vor 16 Jahren.

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

Junior Member Beiträge: 70 Beitrittsdatum: 11.06.07 Neueste Beiträge
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
Fuad Efendi, geändert vor 16 Jahren.

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

Regular Member Beiträge: 180 Beitrittsdatum: 05.04.07 Neueste Beiträge
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
amira princesse, geändert vor 13 Jahren.

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

New Member Beiträge: 7 Beitrittsdatum: 04.01.10 Neueste Beiträge
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
Peter Mesotten, geändert vor 11 Jahren.

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

Junior Member Beiträge: 45 Beitrittsdatum: 04.02.09 Neueste Beiträge
Add the following entry to liferay-portlet.xml:

<add-default-resource>true</add-default-resource>
thumbnail
Tariqul Islam, geändert vor 9 Jahren.

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

New Member Beiträge: 15 Beitrittsdatum: 27.01.13 Neueste Beiträge