RE: Portlet title and border still shows on Freemarker based custom theme

thumbnail
Darth Lord, modified 9 Years ago. New Member Posts: 8 Join Date: 5/21/10 Recent Posts
Hi all,

I'm really stuck on this and run out of possible ideas.

I am building a custom theme, porting a bootstrap 3.1 HTML design to Liferay using Freemarker template. I manage to port the design to Freemarker but I when the theme is deployed, the portlet titles are displayed (see attached screenshots). I'm supecting that there's must be a Javascript error or clash somewhere which preventing Liferay from hiding the portlet titles. I tried disabling it from the look and feel menu option of the portlet but there's no value in the dropdown.

I have attached the portal_normal template file hoping that someone can point out to something that I am doing wrong. The CSS for the custom template is displaying fine. Also forgot to mention that I am new to Freemarker templating.

Thank for your help in advance.

My environment:
- OS: MacOS El Capitain
- IDE: Netbeans with Maven
- Liferay 7.0 GA1 (Tomcat bundle)
- Theme deployed as WAR (copied the theme folders from the Classic theme deployed in Liferay 7 OSGI)
thumbnail
David H Nebinger, modified 9 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
Portlet frame is managed by the portlet.ftl template file. You can find this in the classic theme template directory right next to portal_normal.ftl.

It's a small file and you can see where you'd want to remove the header.
thumbnail
Darth Lord, modified 9 Years ago. New Member Posts: 8 Join Date: 5/21/10 Recent Posts
Thanks David - this was very helpful.

I am still having issues with the Freemarker macros such as the following:

<@liferay_util["include"] page=top_head_include />
<@liferay.navigation_menu default_preferences="${freeMarkerPortletPreferences}" />

Where are they defined and how to modify their outputs? As I mentioned in previous post, I am experiencing some Javascript issues such "You have included XX Javascript library multiple times on this page This is causing issues with as example the login portlet.

Thanks in advance.
thumbnail
David H Nebinger, modified 9 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
Well the include is probably pulling in the output from the top_head_include jsp file which probably pulls in some js, css and meta resources.

The nav_menu guy would be doing your standard navigation menu but shouldn't be including js resources.
Stephen Hardesty, modified 9 Years ago. New Member Posts: 14 Join Date: 5/31/16 Recent Posts
I am using portlet.ftl in my theme I have the portlet display name being output there.
The portlet titles maintain their generic names instead of the custom title entered in the look and feel options i.e. "Asset Publisher" instead of "Custom Title I just typed in". I've been struggling with this longer than I care to admit. What is going wrong here?

This is going on on the top of the .ftl

<#assign portlet_display = portletDisplay />

<#assign portlet_back_url = htmlUtil.escapeHREF(portlet_display.getURLBack()) />
<#assign portlet_display_name = htmlUtil.escape(portlet_display.getPortletDisplayName()) />
<#assign portlet_display_root_portlet_id = htmlUtil.escape(portlet_display.getRootPortletId()) />
<#assign portlet_id = htmlUtil.escapeAttribute(portlet_display.getId()) />
<#assign portlet_toolbar = portlet_display.getPortletToolbar() />

and this is outputting the actual title

<h2>${portlet_display_name}</h2>
thumbnail
David H Nebinger, modified 9 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
The standard portlet.ftl uses the following:

&lt;#assign portlet_title = htmlUtil.escape(portlet_display.getTitle()) /&gt;
...
<h1 class="portlet-title">
    ${theme.portletIconPortlet()} <span class="portlet-title-text">${portlet_title}</span>
</h1>


So title doesn't come from the display name, it comes from the title. My guess is that the portletDisplay object has the logic to return the correct title where the display name just does the display name.
Stephen Hardesty, modified 9 Years ago. New Member Posts: 14 Join Date: 5/31/16 Recent Posts
Thank you so much Dave. That worked in the portlet.ftl. Now I'm trying to move that into an application display template. It still outputs "Asset Publisher" though even though I switched to portlet_title there as well. Why would it work on the portlet.ftl and not in the Application display template .ftl?

Also, how can I access this attribute for a given asset publisher instance - portletSetupUseCustomTitle ?
thumbnail
David H Nebinger, modified 9 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
It's a portlet pref (well not really a pref, but kinda a pref I guess), I don't know if the ADT can access portlet prefs or not but I've never tried it myself.
Stephen Hardesty, modified 9 Years ago. New Member Posts: 14 Join Date: 5/31/16 Recent Posts
Dave and anyone who wants to optionally display portlet titles,
I accessed it from the portlet.ftl like this -
<#assign portlet_display = portletDisplay>
<#assign portlet_title = htmlUtil.escape(portlet_display.getTitle())>
<#assign portlet_setup = portlet_display.getPortletSetup()>
<#assign portlet_show_title = portlet_setup.getValue("portletSetupUseCustomTitle","Boolean")>

Then I can show or not show the portlet title based on it's value -
<#if portlet_show_title == 'true'>
<h2 class="portlet-title-text">${portlet_title}</h2>
</#if>

I haven't been able to get the same thing to work in my application display template. It seems you should be able to because when you enter the edit screen for an ADT you have the option of adding ${portletPreferences} from the "general variables" section on the left. I have been able to loop through the ${portletPreferences} hash and display the key name, but so far have been unable to output the key values. I think this is probably just me fumbling with the syntax and should be easy to do?...
thumbnail
Michael Adamczyk, modified 7 Years ago. New Member Posts: 11 Join Date: 3/16/12 Recent Posts
Stephen Hardesty:
 I haven't been able to get the same thing to work in my application display template. It seems you should be able to because when you enter the edit screen for an ADT you have the option of adding ${portletPreferences} from the "general variables" section on the left. I have been able to loop through the ${portletPreferences} hash and display the key name, but so far have been unable to output the key values. I think this is probably just me fumbling with the syntax and should be easy to do?...

 

In an ADT in 6.2 and 7.0 you can use:

&lt;#assign portletCustomTitle = themeDisplay.getPortletDisplay().getTitle() /&gt;
${portletCustomTitle}