Forums

Home » Liferay Portal » English » Liferay Legacy

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Toni Aho
How to include portlet or content to my theme's layout?
September 20, 2007 11:49 PM
Answer

Toni Aho

Rank: New Member

Posts: 13

Join Date: September 20, 2007

Recent Posts

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
RE: How to include portlet or content to my theme's layout?
September 21, 2007 1:40 AM
Answer

atul patel

Rank: Regular Member

Posts: 190

Join Date: November 17, 2006

Recent Posts

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", "")
$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" 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" 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=3,6
#layout.static.portlets.end.column-1=14
#layout.static.portlets.start.column-2=71_INSTANCE_abcd,7
#layout.static.portlets.end.column-2=34,70
#layout.static.portlets.start.column-3=
#layout.static.portlets.end.column-3=

#
# 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=3,6
#layout.static.portlets.end.column-2=14

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

#
# Set the static layouts for organization layouts.
#
#layout.static.portlets.start.column-1=
#layout.static.portlets.end.column-1=
#layout.static.portlets.start.column-2=
#layout.static.portlets.end.column-2=
#layout.static.portlets.start.column-3=
#layout.static.portlets.end.column-3=
Toni Aho
RE: How to include portlet or content to my theme's layout?
September 21, 2007 5:39 AM
Answer

Toni Aho

Rank: New Member

Posts: 13

Join Date: September 20, 2007

Recent Posts

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
RE: How to include portlet or content to my theme's layout?
September 21, 2007 7:39 AM
Answer

atul patel

Rank: Regular Member

Posts: 190

Join Date: November 17, 2006

Recent Posts

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", "")
$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 Aho
RE: How to include portlet or content to my theme's layout?
September 24, 2007 12:49 AM
Answer

Toni Aho

Rank: New Member

Posts: 13

Join Date: September 20, 2007

Recent Posts

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
RE: How to include portlet or content to my theme's layout?
September 24, 2007 2:44 AM
Answer

atul patel

Rank: Regular Member

Posts: 190

Join Date: November 17, 2006

Recent Posts

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", "")
$theme.runtime("71_INSTANCE_MAIN", "", $velocityPortletPreferences.toString())
$velocityPortletPreferences.reset()
Reinier de Graaf
RE: How to include portlet or content to my theme's layout?
November 6, 2007 3:26 AM
Answer

Reinier de Graaf

Rank: New Member

Posts: 15

Join Date: October 25, 2007

Recent Posts

Hello,

I have added an RSS portlet into our theme:
1            $velocityPortletPreferences.setValue("urls", "$company_url/c/blogs/rss?p_l_id=11009&groupId=10098")
2            $velocityPortletPreferences.setValue("items-per-channel", "5")
3
4            $theme.runtime("39_INSTANCE_RM01", "", $velocityPortletPreferences.toString()) ## rss portlet
5            
6            $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
RE: How to include portlet or content to my theme's layout?
November 13, 2007 10:24 AM
Answer

Trollbahrt Wunderlich

Rank: Junior Member

Posts: 70

Join Date: June 11, 2007

Recent Posts

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
Fuad Efendi
RE: How to include portlet or content to my theme's layout?
November 14, 2007 8:21 AM
Answer

Fuad Efendi

Rank: Regular Member

Posts: 169

Join Date: April 5, 2007

Recent Posts

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?
Amira princesse
RE: How to include portlet or content to my theme's layout?
April 12, 2011 9:07 AM
Answer

Amira princesse

Rank: New Member

Posts: 8

Join Date: January 4, 2010

Recent Posts

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
 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.


could any of you help me plz
Peter Mesotten
RE: How to include portlet or content to my theme's layout?
February 26, 2013 4:34 AM
Answer

Peter Mesotten

Rank: Junior Member

Posts: 37

Join Date: February 4, 2009

Recent Posts

Add the following entry to liferay-portlet.xml:

<add-default-resource>true</add-default-resource>
Tariqul Islam
RE: How to include portlet or content to my theme's layout?
February 23, 2015 11:07 AM
Answer

Tariqul Islam

Rank: New Member

Posts: 15

Join Date: January 27, 2013

Recent Posts