Message Boards

Liferay 7.2 - How to show my web content?

Fabio Carvalho, modified 4 Years ago.

Liferay 7.2 - How to show my web content?

Junior Member Posts: 81 Join Date: 6/25/19 Recent Posts
Hi,

I am trying to create a hyperlink to my web content and I read that you can do it like this:
themeDisplay.getURLCurrent() + "/-/journal_content/56/" + journalArticle.getGroupId() + "/" + journalArticle.getArticleId();


But when I clink my hyperlink I get redirected to something like this:

Could that "56" be a wrong ID? What would be the correct way to show my web content in a new page?
thumbnail
Fernando Fernandez, modified 4 Years ago.

RE: Liferay 7.2 - How to show my web content?

Expert Posts: 396 Join Date: 8/22/07 Recent Posts
What's wrong with just using the Webcontent display portlet that comes with Liferay? Or, if you want dynamic selection of the content, the Asset Publisher portlet that comes with Liferay?
thumbnail
Olaf Kock, modified 4 Years ago.

RE: Liferay 7.2 - How to show my web content?

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts
On top of what Fernando says: An ID like "56" points to 6.x versions - You're asking for 7.2 and the ids have changed dramatically. "56" definitely is not a correct id any more.
Fabio Carvalho, modified 4 Years ago.

RE: Liferay 7.2 - How to show my web content?

Junior Member Posts: 81 Join Date: 6/25/19 Recent Posts
Hi Fernando and Olaf,

This is a dynamic selection, so I was trying to create a page on the fly to show my Journal Article. The only examples that I found was by creating the URL with this ID that only works on Liferay 6. 

So if I understood correctly, the solution is to use the Asset Publisher for dynamic web content selection is that right? Are there any examples on how to do this?

Thanks!
thumbnail
Olaf Kock, modified 4 Years ago.

RE: Liferay 7.2 - How to show my web content?

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts
Fabio Carvalho:

This is a dynamic selection, so I was trying to create a page on the fly to show my Journal Article. The only examples that I found was by creating the URL with this ID that only works on Liferay 6. 

So if I understood correctly, the solution is to use the Asset Publisher for dynamic web content selection is that right? Are there any examples on how to do this?
It all depends on the "dynamic selection": That's not a concept where those two words seem to be enough.
You may try to configure an AssetPublisher and look for its mechanics to show a single article, e.g. in the detail view.
Fabio Carvalho, modified 4 Years ago.

RE: Liferay 7.2 - How to show my web content?

Junior Member Posts: 81 Join Date: 6/25/19 Recent Posts
To create objects of my model class I am doing like this:
public DataSource(JournalArticle journalArticle) throws PortalException {
    targetURL = journalArticle.getUrlTitle();
}

Then on my view.jsp:
<aui:container>
&nbsp; &nbsp; &lt;% for (int i = 0; i &lt; dataSources.size(); i++) { %&gt;
&nbsp; &nbsp; &nbsp; &nbsp; <a href="<%= dataSources.get(i).getTargetURL() %>"> Some Journal Article Text </a>
&nbsp; &nbsp; &lt;% } %&gt;
​​​​​​​</aui:container>

What I mean by "dynamic selection" is that I create a list in my container, and each item should have a different URL. What I want to do is to redirect to a page with the content of the JournalArticle.
thumbnail
Olaf Kock, modified 4 Years ago.

RE: Liferay 7.2 - How to show my web content? (Answer)

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts
Fabio Carvalho:

What I mean by "dynamic selection" is that I create a list in my container, and each item should have a different URL. What I want to do is to redirect to a page with the content of the JournalArticle.
That's precisely what AssetPublisher does: First dynamically filtering any number of articles, shows them (optionally) in an abbreviated (abstract) form, and provides a link to view everything. That link is to a page that contains the full article.
Note: Articles also can have a Display Page, which is a page with an AssetPublisher marked as Default: This way you can determine where on the page the article is shown, and even show other content on the same page.
I'd say: Look at AssetPublisher - if only for link generation. Also look at Display Pages - see if they can do the job for you.
Fabio Carvalho, modified 4 Years ago.

RE: Liferay 7.2 - How to show my web content?

Junior Member Posts: 81 Join Date: 6/25/19 Recent Posts
Hi Olaf,

I went with the Display Pages option and seems to be what I want. I didn't know what Display Pages were supposed to do before.

Thanks a lot!