掲示板

Add portlet above navigation header

thumbnail
15年前 に chris chris chris によって更新されました。

Add portlet above navigation header

Regular Member 投稿: 179 参加年月日: 07/09/25 最新の投稿
Hi all,

Is it possible to add portlet above the navigation header ( block with Home Products Services Partners... ) menu ? If possible, do I have to modify the theme or layout ?
I want to be able to put article above the navigation header, for example advertisement, etc.

Thanks in advance.
thumbnail
15年前 に Tobias Amon によって更新されました。

RE: Add portlet above navigation header

Liferay Master 投稿: 546 参加年月日: 07/08/08 最新の投稿
Hello,

you can have a look at the liferay-jedi-theme --> Link

It has a static journal article at the bottom.

<div class="footer-award-images">
				#set ($journalArticleLocalService = $serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleLocalService"))

				#set ($journalArticleId = $theme_settings.getProperty("footer-article-id"))

				#if ($journalArticleLocalService.hasArticle($guestGroup.getGroupId(), $journalArticleId))
					$velocityPortletPreferences.setValue("portlet-setup-show-borders", "false")
					$velocityPortletPreferences.setValue("group-id", "$guestGroup.getGroupId()")
					$velocityPortletPreferences.setValue("article-id", $journalArticleId)

					$theme.runtime("56_INSTANCE_a453", "", $velocityPortletPreferences.toString())

					$velocityPortletPreferences.reset()
				#end
			</div>
thumbnail
15年前 に Ray Augé によって更新されました。

RE: Add portlet above navigation header

Liferay Legend 投稿: 1197 参加年月日: 05/02/08 最新の投稿
In 5.1.x, and in 5.1.2 you are able to do this much more easily via:

#set ($journalContent = $journalContentUtil.getContent($groupId, "MY_ARTICLE_ID", $locale.toString(), $xmlRequest))
$journalContent
thumbnail
15年前 に chris chris chris によって更新されました。

RE: Add portlet above navigation header

Regular Member 投稿: 179 参加年月日: 07/09/25 最新の投稿
Thanks Tobias, Ray,

But is it possible that I moved the header to layout, so the header is easily drag and drop anywhere on the page. so the theme just a blank theme. And I can put the article above the header easily by drag and drop.
Because that solution that you offered tied me to hardcode the article ID inside the theme, and this is not user friendly, since my user is not a technical user.



Ray Augé:
In 5.1.x, and in 5.1.2 you are able to do this much more easily via:

#set ($journalContent = $journalContentUtil.getContent($groupId, "MY_ARTICLE_ID", $locale.toString(), $xmlRequest))
$journalContent
thumbnail
15年前 に Gnaniyar Zubair によって更新されました。

RE: Add portlet above navigation header

Liferay Master 投稿: 722 参加年月日: 07/12/19 最新の投稿
Hi Ray,

As you said, i have given this below code in portal_normal.vm file . my article id also 12108. but it is not affecting.

#set ($journalContent = $journalContentUtil.getContent($groupId, "12108", $locale.toString(), $xmlRequest))
$journalContent


But before navigation i got this line only in screen : $journalContent ( attached screen shots)

Pls clarify?

添付ファイル:

thumbnail
15年前 に Ray Augé によって更新されました。

Re: [Liferay Forums][4. Custom Theme Development] RE: Add portlet above nav

Liferay Legend 投稿: 1197 参加年月日: 05/02/08 最新の投稿
> 1#set ($journalContent = $journalContentUtil.getContent($groupId,
> "12108", $locale.toString(), $xmlRequest))
> 2$journalContent


Ok, couple things to check...

1 - check your portal version (you need 5.1.x >= revision #20079)
2- [tt]$groupId[/tt] resolves to the current Community you are in (and not the groupId of the article)... you might want to be explicit for this field as this won't work on non-community pages.

HTH!
15年前 に hameethun nihar によって更新されました。

RE: Re: [Liferay Forums][4. Custom Theme Development] RE: Add portlet above

New Member 投稿: 4 参加年月日: 08/08/05 最新の投稿
Hi All,

I have successfully added the journal content portlet in the footer and also article appears.
The code used is as follows:
in portal-normal.vm
<div id="footer">

#set ($journalArticleLocalService = $serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleLocalService"))

#set ($journalArticleId = $theme_settings.getProperty("footer-article-id"))

$velocityPortletPreferences.setValue("portlet-setup-show-borders", "false")

$velocityPortletPreferences.setValue("group-id", "$guestGroup.getGroupId()")

$velocityPortletPreferences.setValue("article-id", $journalArticleId )

$theme.runtime("56_INSTANCE_AJVK", "", $velocityPortletPreferences.toString())

$velocityPortletPreferences.reset()

</div>


But the problem is it appears only on the page it is been added and on the other pages it say
"11404 is expired, is not approved, does not have any content, or no longer exists."



Please give me the solution.
thumbnail
15年前 に Christianto Sahat によって更新されました。

RE: Re: [Liferay Forums][4. Custom Theme Development] RE: Add portlet above

Regular Member 投稿: 179 参加年月日: 07/09/25 最新の投稿
Ray Augé:
> 1#set ($journalContent = $journalContentUtil.getContent($groupId,
> "12108", $locale.toString(), $xmlRequest))
> 2$journalContent


Ok, couple things to check...

1 - check your portal version (you need 5.1.x >= revision #20079)
2- [tt]$groupId[/tt] resolves to the current Community you are in (and not the groupId of the article)... you might want to be explicit for this field as this won't work on non-community pages.

HTH!


Hi Ray,

I use Liferay 5.1.1, so this solution should be working. But still I have problem to display Journal article on theme.


#set ($journalContent = $journalContentUtil.getContent($groupId, "12108", $locale.toString(), $xmlRequest))
$journalContent

With the above solution, I can only get string $journalContent displayed on my theme. How to get groupId of current community ? The condition is : user is not login, so I think the community is 'Guest' community, and I can't get groupId through $user variable, since it will be null whenever user is not login.

Thanks in advance.
15年前 に Imre Széll によって更新されました。

RE: Add portlet above navigation header

New Member 投稿: 1 参加年月日: 08/11/09 最新の投稿
Gnaniyar Zubair:
Hi Ray,

As you said, i have given this below code in portal_normal.vm file . my article id also 12108. but it is not affecting.

#set ($journalContent = $journalContentUtil.getContent($groupId, "12108", $locale.toString(), $xmlRequest))
$journalContent


But before navigation i got this line only in screen : $journalContent ( attached screen shots)

Pls clarify?


Hi!

I had the same problem. Removing the quotation marks around the number solved the problem. (In case of groupId, Liferay 5.1.2).
My code looks like this (in a theme portal_normal.vm):
#set ($journalArticleId = $theme_settings.getProperty("footer-article-id"))
#set ($journalContent = $journalContentUtil.getContent(10122, $journalArticleId, $locale.toString(), $xmlRequest))
$journalContent
11年前 に Wayne Akey によって更新されました。

RE: Add portlet above navigation header

New Member 投稿: 1 参加年月日: 12/08/06 最新の投稿
Just want to say thank you for the code and advice on the post. Got some great advice.



___________________
Payment gateway
thumbnail
15年前 に Daniel Bleisteiner によって更新されました。

RE: Add portlet above navigation header

New Member 投稿: 16 参加年月日: 08/06/17 最新の投稿
These examples all refer to the article portlet. Is there a more general way to add some reserved space inside a theme - outside a layout - for any portlet? In my case I want to place a special login portlet from our portal in an area not part of the layout.
thumbnail
15年前 に Daniel Bleisteiner によって更新されました。

RE: Add portlet above navigation header

New Member 投稿: 16 参加年月日: 08/06/17 最新の投稿
Without any further answers I had to switch to a completly empty theme where everything is placed using portlets. All navigation elements are portlets now and so we are able to mix them with other portlets. Maybe it's the best solution anyway... most flexible.
15年前 に Michal Selmeci によって更新されました。

RE: Add portlet above navigation header

New Member 投稿: 13 参加年月日: 08/10/12 最新の投稿
You can add the portlet anywhere on your page just adding this command in your template:

$theme.runtime("PORTLET_ID")

Where PORTLET_ID is an ID of the portlet you want to add. It has some other parameters which I don't remember. See in spec if you want emoticon

Michal
thumbnail
15年前 に delang j によって更新されました。

RE: Add portlet above navigation header

Expert 投稿: 252 参加年月日: 08/07/14 最新の投稿
what about language portlet? and how do i set it's display style to short text?

thanks
thumbnail
14年前 に Sebastián Gurin によって更新されました。

RE: Add portlet above navigation header

Junior Member 投稿: 75 参加年月日: 07/06/13 最新の投稿
delang j:
what about language portlet? and how do i set it's display style to short text?

thanks


as other have said, you can add a portlet with $theme.runtime("portletId") (a number with quotes). You can obtain the desired portlet id lookin at /portal-web/docroot/WEB-INF/liferay-portlet.xml

In the case of the language portlet, you also can simply call $theme.language()

all of this works fine in liferay 4.4.1 in a velocity theme

hope this can help somebody
thumbnail
15年前 に delang j によって更新されました。

RE: Add portlet above navigation header

Expert 投稿: 252 参加年月日: 08/07/14 最新の投稿
Michal, could you explain more details please
thumbnail
15年前 に delang j によって更新されました。

RE: Add portlet above navigation header

Expert 投稿: 252 参加年月日: 08/07/14 最新の投稿
Michal Selmeci:
You can add the portlet anywhere on your page just adding this command in your template:

$theme.runtime("PORTLET_ID")

Where PORTLET_ID is an ID of the portlet you want to add. It has some other parameters which I don't remember. See in spec if you want emoticon

Michal


i already tested it but it doesn't work properly. Only configuration button works but when i click look and feel button, nothing happen. Anyone know how to solve this?

thanks
thumbnail
14年前 に Sebastián Gurin によって更新されました。

RE: Add portlet above navigation header

Junior Member 投稿: 75 参加年月日: 07/06/13 最新の投稿
for adding the language portlet you can use

<span id="themeDockLanguagePortlet">$taglibLiferay.language()</span>

also, in general, as other said, if you know the id of the portlet you want to add, you can do:

<span>$theme.runtime("82")</span>

first is tested on liferay 5.2 and second on liferay 441

good look
thumbnail
12年前 に Jignesh Shukla によって更新されました。

RE: Add portlet above navigation header

New Member 投稿: 9 参加年月日: 11/06/06 最新の投稿
What about liferay 6ee sp2 ?

I see the method signature is different. It now expects one more argument called viewMode(String type).

I tried using following one from my theme velocity template (navigation.vm) file

public JournalArticleDisplay getDisplay(
long groupId, String articleId, String viewMode, String languageId,
ThemeDisplay themeDisplay);

as following :

#set($myContent = $journalContentUtil.getContent($group_id, $prod.articleId,

"view",$locale,$theme_display))

my content = $myContent

But above line prints the value as: $myContent

I checked to see if $journalContentUtil is available from init.vm and it does.

It prints the value as com.liferay.portlet.journalcontent.util.JournalContentImpl@7ab18869

Not sure what's going wrong here. Am I missing anything ?
thumbnail
12年前 に Jignesh Shukla によって更新されました。

RE: Add portlet above navigation header

New Member 投稿: 9 参加年月日: 11/06/06 最新の投稿
I found the problem.

It accepts articleId as string and the value I was passing was in long format. I just changed it to string and it worked.

Thanks
Jignesh
thumbnail
11年前 に Krati Gupta によって更新されました。

RE: Add portlet above navigation header

Regular Member 投稿: 119 参加年月日: 08/12/05 最新の投稿
Hi,

I have Code works for me but some error , it will be great if u help me in my issue also , the following is the issue :

My Code :

#set ($tabs1URL = $portletURLFactory.create($request, "ABC", $page.getPlid(), "RENDER_PHASE"))
$tabs1URL.setWindowState("maximized")
$tabs1URL.setPortletMode("view")
$tabs1URL.setParameter("tabs1","Basic")

$tabs1URL.setParameter("struts_action", "/ABC/viewSearch")


<form id="fm" action="$tabs1URL" method="post" name="ABC" onsubmit="submitForm(this); return false;">
<input type="textbox" style="height: 24px; width: 200px;" id="uname1" name="uname1" value="People Search" onFocus="if (this.value == 'People Search') { this.value = ''; }" />
<input type="hidden" name="flag" id="flag" value="true"/>
<input type="submit" id="nsubmit" name="nsubmit" value="Search" />
</form>

By applying above code in theme my custom search textbox is coming in theme, but when I search any keyword its show only one result which I have searched from People Search Module .as per my debugging my struts_action is not calling , when i am searching from theme text box .