Fórum

Add portlet above navigation header

thumbnail
chris chris chris, modificado 15 Anos atrás.

Add portlet above navigation header

Regular Member Postagens: 179 Data de Entrada: 25/09/07 Postagens Recentes
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
Tobias Amon, modificado 15 Anos atrás.

RE: Add portlet above navigation header

Liferay Master Postagens: 546 Data de Entrada: 08/08/07 Postagens Recentes
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
Ray Augé, modificado 15 Anos atrás.

RE: Add portlet above navigation header

Liferay Legend Postagens: 1197 Data de Entrada: 08/02/05 Postagens Recentes
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
chris chris chris, modificado 15 Anos atrás.

RE: Add portlet above navigation header

Regular Member Postagens: 179 Data de Entrada: 25/09/07 Postagens Recentes
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
Gnaniyar Zubair, modificado 15 Anos atrás.

RE: Add portlet above navigation header

Liferay Master Postagens: 722 Data de Entrada: 19/12/07 Postagens Recentes
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
Ray Augé, modificado 15 Anos atrás.

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

Liferay Legend Postagens: 1197 Data de Entrada: 08/02/05 Postagens Recentes
> 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!
hameethun nihar, modificado 15 Anos atrás.

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

New Member Postagens: 4 Data de Entrada: 05/08/08 Postagens Recentes
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
Christianto Sahat, modificado 15 Anos atrás.

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

Regular Member Postagens: 179 Data de Entrada: 25/09/07 Postagens Recentes
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.
Imre Széll, modificado 15 Anos atrás.

RE: Add portlet above navigation header

New Member Mensagem: 1 Data de Entrada: 09/11/08 Postagens Recentes
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
Wayne Akey, modificado 11 Anos atrás.

RE: Add portlet above navigation header

New Member Mensagem: 1 Data de Entrada: 06/08/12 Postagens Recentes
Just want to say thank you for the code and advice on the post. Got some great advice.



___________________
Payment gateway
thumbnail
Daniel Bleisteiner, modificado 15 Anos atrás.

RE: Add portlet above navigation header

New Member Postagens: 16 Data de Entrada: 17/06/08 Postagens Recentes
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
Daniel Bleisteiner, modificado 15 Anos atrás.

RE: Add portlet above navigation header

New Member Postagens: 16 Data de Entrada: 17/06/08 Postagens Recentes
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.
Michal Selmeci, modificado 15 Anos atrás.

RE: Add portlet above navigation header

New Member Postagens: 13 Data de Entrada: 12/10/08 Postagens Recentes
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
delang j, modificado 15 Anos atrás.

RE: Add portlet above navigation header

Expert Postagens: 252 Data de Entrada: 14/07/08 Postagens Recentes
what about language portlet? and how do i set it's display style to short text?

thanks
thumbnail
Sebastián Gurin, modificado 14 Anos atrás.

RE: Add portlet above navigation header

Junior Member Postagens: 75 Data de Entrada: 13/06/07 Postagens Recentes
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
delang j, modificado 15 Anos atrás.

RE: Add portlet above navigation header

Expert Postagens: 252 Data de Entrada: 14/07/08 Postagens Recentes
Michal, could you explain more details please
thumbnail
delang j, modificado 15 Anos atrás.

RE: Add portlet above navigation header

Expert Postagens: 252 Data de Entrada: 14/07/08 Postagens Recentes
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
Sebastián Gurin, modificado 14 Anos atrás.

RE: Add portlet above navigation header

Junior Member Postagens: 75 Data de Entrada: 13/06/07 Postagens Recentes
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
Jignesh Shukla, modificado 12 Anos atrás.

RE: Add portlet above navigation header

New Member Postagens: 9 Data de Entrada: 06/06/11 Postagens Recentes
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
Jignesh Shukla, modificado 12 Anos atrás.

RE: Add portlet above navigation header

New Member Postagens: 9 Data de Entrada: 06/06/11 Postagens Recentes
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
Krati Gupta, modificado 11 Anos atrás.

RE: Add portlet above navigation header

Regular Member Postagens: 119 Data de Entrada: 05/12/08 Postagens Recentes
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 .