I find in the Default.jsp the portlets are displayed by the tag "portal-core:screenRender"; but I want to add an extra portlet to the Default.jsp, is there any way to render a specific portlet?
I have to assume you just want to a portlet to a page rather than embed a portlet in the theme itself. Adding portlet to the Default.jsp should be avoided at all costs. Not only would that be a bad place to start customizing theme to edit the theme to embed a portlet but also just the idea of trying to embed a portlet in the theme makes me shudder a bit.
If you're just trying to add a portlet to a page, first login in as a Portal Administrator. You can then either a) navigate to the page you want to change and use the Edit Mode of the page to add a portlet from the page itself or b) go the Administration page, click "Manage Pages", find your page and edit the page there.
Related
I am using Liferay 7.2. I want to display the viewURL link of an asset publisher in a Display Page Templates page. I couldn’t solve the problem. After searching, I realized that this problem can be solved in three ways:
Method 1:
1- As and admin, in Web Content>Structures create a structure (News Article) and make a Template for that structure.
2- Create page A and add an asset publisher. In this asset publisher: In Asset Selection choose Web Content Article as Asset Type and choose News Article as sub structure. In Display Setting tab choose View in Context as Asset Link Behavior.
3-In Site Builder>Pages create a Display Page Template (page B). Edit it and add an asset publisher similar to page A. However, in page B, in Configuration of asset publisher, in Display Settings choose Show Full Content as Asset Link Behavior and tick Set as the Default Asset Publisher for This Page and Show only assets with Page B as its display page template.
4-Create some News Article. In Display Page Template section, choose Specific Display Page Template and Page B.
In page A, everything is OK. However, when I click on ViewURL of an asset entry, it will redirect to page B. But, in asset publisher section of page B, no results is shown (There are no results.). Means that the chosen asset of page A is not shown in Display Page Template of page B.
Method 2:
Maybe the simplest method is editing Display Page Template (page B) in Section Builder>Content Display add Display Page Template. However, as stated in this issue , the display page content section only shows the summary and no style can be shown. Maybe it is necessary to edit abstract.jsp file. But, I don’t know how to do this.
Method 3:
Create a Widget Template and add it to page B. The article data of the selected asset can be obtained from the URL. However, I couldn’t get the data of the selected article.
I appreciate for any help in this regard.
An Asset Publisher instantiated in a Display Page Template won't show the page Web Content. One way to show an Web Content in a Display Page Template, is to instantiate a Fragment and map the Web Content fields to it, as shown here.
So, to solve your problem, you would need to change Page's B Asset Publisher to one or more Fragments, and map your News Article fields to them.
You could also map the Web Content to your own custom Fragmets, using Fragments lfr-editable fields
<lfr-editable id="unique-id" type="text">
This is editable text!
</lfr-editable>
Another way is to get the Web Content Java Object instance inside a Freemarker (a Fragment, Widget Template, Web Content Template, etc) with this snippet (only works for 7.3+)
${Request.INFO_ITEM}
I am creating a website that has a huge number of forms that are called from a dynamically created menu. There may be a number of other pages on the site that are basic HTML layouts. I was thinking to use Wordpress as the controller for my site. That way I do not have to replicate the Wordpress layout features. I would need to do the following:
Have Wordpress get the contents of the menu using AJAX which would
return the descriptions and the links to the pages.
On selection of an option from the menu open the page in an iframe.
Is this even possible and, if so, where would I start?
I've noticed that sometimes liferay loads the content of a portlet using ajax. For example, we've done some heavy duty web content templates and sometimes I can see a loading spinner while rendering the page.
I know about ajaxable and render-weight properties in liferay-portlet.xml, but... how does liferay know whether to render a portlet content using ajax or not? and second question, is it any way to disable this feature for asset publisher and web content display portlets without changing liferay's internal liferay-portlet.xml?
By default ajaxable is set to true.
In order to modify this you can try updating the render-weight and ajaxable attributes using the class PortletPreferences.
Read more here: https://www.liferay.com/community/forums/-/message_boards/message/11904281
I have created a grails liferay portlet. I need to dynamically show/hide portlets in certain pages through IPC events.
For example based on my first page's submit action, i need to publish an event to the other portlets. Rest of the portlets need to process the event value and it should be decided whether portlets needs to be displayed or not. :(
Please help me out !
In your eventhandler, you can easily set
response.setRenderParameter("showSomething", "true");
and then, in render
if(response.getParameter("showSomething").equals("true")) {
// actually show something
} else {
// just render nothing
}
(Pseudocode: Add null-checks & make more elegant as appropriate)
You'll want to hide portlet borders for those portlets that you don't show. Alternatively, you might want to find out CSS classes of your portlet and render a CSS instruction to { display:none; } for your portlet, although this is dangerous: Your page admin needs a way to move the portlet around or delete it. Completely hiding all controls effectively makes it impossible to know what portlet is on the page.
I am using WebSphere Portal 8 and I am facing one issue related to session clearing on Portal Page link click. I have a portal page with one single portlet (Search Portlet) and it is working fine. Then after some search I navigate to another unrelated page and again click on the link to Search Portlet. The problem is previously selected values are still present in UI.
I want to know is there any way I will know which Page Link is clicked so that I can clear session in Portlet Class. Or is there anyway to pass some parameters once a Page Link is clicked.
Thanks in Advance!
Pradeep
Portal maintains the state of the portlet, redirecting to page with clean URL will do the trick.