Call Custom aAction from Liferay Theme - liferay

I have A Custom Theme project & A Custom portlet project in liferay.
I want to call a custom action which is in Custom portlet from navigation.vm File of Theme Project.
actionurl is : /c/journal/upload_article which is called from same portlet project successfully.
How to call this from theme project?
Any help is really appreciated.

It sounds weird to "call" an action from a theme. If you embed a form to upload content on every page, naturally, you'd need a target for the upload. But still, the theme seems to be the wrong place to do so.
Nevertheless: It seems that you're using a non-custom URL for uploading (/c/journal/upload_article). You can do so from wherever in HTML. The big question then is: Where will you end up after the upload, as it doesn't happen from within a page.
If you need a proper portlet URL on an individual page, and want to return to the same page, the best way forward is to embed a portlet in the theme (which makes a great search term for Liferay's documentation). From that portlet you can utilize Liferay's API to do what you're trying to achieve. Make it a very lightweight portlet, because, well, it will be embedded on every single page.

Related

Liferay : How to see which portlets are composing a page?

I'm new to liferay.
I imported a big lar into my liferay instance but, for the moment, have none of the required portlets : there are a lot of portlets in the project I'm joining.
Currently, I have the site structure, but the pages display the message that the portlet is not here (logical).
For comprehension purposes, I wanted to build my portlets one after the other, on the need, to see them appear by the grace of liferay ;-)
But for that I wanted to know which portlet is missing.
This thread : How can i find - which portlets are deployed on which pages in Liferay 6.1? explain how to achieve this through the DB.
Is there really no built-in solution to do it through the liferay interface? Have we really to hack in the DB to get the info or install plugin?
Thanks!
In your browser console, Liferay.Portlet.list contains all portlets in the page.
This value is generated by themeDisplay.getLayoutTypePortlet().getAllPortlets() on the server.
As an alternative you can also look at the HTML code of the page and look for elements with the class portlet-boundary. For example this belongs to an instance of the Journal Content Portlet (Portlet name 56):
<div class="portlet-boundary portlet-boundary_56_ portlet-static portlet-static-end portlet-borderless portlet-journal-content full-screen" id="p_p_id_56_INSTANCE_WdRdMGe86kDa_">

Finding specfic jsp page and extenting functionality using hook

I am using liferay. I want to add new functionality to existing jsp page.
I will be using hooks for that purpose.
The problem is how to find existing jsp pages locations?
For example
I want to locate "Add regular Organization" page.
Pls help
Thank you
jsp files under source folder : html\portlet\users_admin\organization and html\portlet\users_admin\edit_organization.jsp are jsps for "Add regular Organization" page.
There are certain ways, liferay provides its functionalities using default portlets that comes with liferay-bundle. You can look at folder portal-web\docroot\html\portlet under portal-src, it will give you idea to locate jsp page locations.
Moreover you can look at portal-web\docroot\WEB-INF\portlet-custom.xml, portal-web\docroot\WEB-INF\struts-config.xml and portal-web\docroot\WEB-INF\tiles-defs.xml for portlet specific actions and respective jsps.

Use a web content portlet

I am using web content portlet to develop a portal.
Each page has common theme (which includes header and footer) and we have many portlets placed on each page.
One of the portlet on right side is menu which is common on many pages.
I could have kept it as a part of theme but the menu can be subject to change in future and the end user who will be handling the portal is non-developer.
So if they want to change some data in that menu portlet, they will have to change it on every page which leads to duplication of effort.
Like I said, since end user is a non-developer, I cannot make that portlet part of the theme.
So is there any way where one web content portlet be created once and used on many pages?
You can embed web-content in theme as per link
Here articleId as in above link, you can set in theme-setting, refer to link
I have found a solution right now. If anyone has abetter solution than this..they are most welcome. I would like people to share alternate and better solutions
I am using Liferay 6.2
What I did was added a new web content display portlet which like I said created a new blank web content display portlet.
So my usual method was to add content to this portlet. THis was the method I followed. You can click on Select Web Content button and then select the already created portal from the list and you are done. NO need to create duplicate portlets

Adding pages and templates to a portlet

I am using eclipse ide and I have created a liferay project Test-portlet. I haven't written any code for this project
When I ran this project I got the usual welcome screen and I added the Test-portlet to the page and removed other stuff from the page.
I actually want to create a website using liferay. The website already exists which should be rewritten in liferay.
So when I load the project I get this welcome screen and the Test-portlet. At the top of this page I get the the menu-Admin,Sites,.... and LIferay logo on LHS.
I wish to remove all of these and displa only the web page data of the website. I know I can use themes and layouts for such purpose.
If I should use portlet to create this website , how should I keep adding pages and designs?
Also how should I add pages,themes,templates to this portlet?
Before creating this Test-portlet project, I had created pages using control panel.
How should I create this website? Using portlet by creating project?
EDIT:
Also this Test-portlet is displayed as a small portlet on the entire page. WHen click on the gear symbol and click on maximise, it only maximises during that time and when project is run again, it comes back to its original size.
Should I create this websiste using portlets?
Data for website comes from database. Few pages have static data.
Subsequent pages may be added in future.
HOw should the pages be added if I use portlet to create the website?
Please go through liferay themes and liferay layouts

Liferay portlet for creating web content

I use Liferay to manage web content. I would like my end users to create web content but I don't want them to go to back office to manage it.
So I would like a portlet that I can setup in public pages and which allows the end users to create web content directly in public pages.
Is there a simple way to do it using Liferay 6.1 or code is needed ?
Have you tried OOTB Web Content Display portlet? You can add Web Content Display portlet on any page and content can be created in that portlet itself which on publishing(if no workflow involved) will be visible on the page.
If Sandeep's answer is not what you're after (but I suspect it is) then you can write a custom portlet that uses Liferay's JournalArticleLocalServiceUtil methods to interact with Liferay Web Content. However I'd go with Sandeep's suggestion first as it doesn't involve coding! :)
If you want to develope another webcontent portlet as avaiable in control panel. You have to go for custom portlet creation and use the db tables like JournalArticle, JournalArticleImage, JournalArticleStructure and JournalArticleTemplate.

Resources