Foros de discusión

Add portlet above navigation header

thumbnail
chris chris chris, modificado hace 15 años.

Add portlet above navigation header

Regular Member Mensajes: 179 Fecha de incorporación: 25/09/07 Mensajes recientes
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 hace 15 años.

RE: Add portlet above navigation header

Liferay Master Mensajes: 546 Fecha de incorporación: 8/08/07 Mensajes recientes
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 hace 15 años.

RE: Add portlet above navigation header

Liferay Legend Mensajes: 1197 Fecha de incorporación: 8/02/05 Mensajes recientes
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 hace 15 años.

RE: Add portlet above navigation header

Regular Member Mensajes: 179 Fecha de incorporación: 25/09/07 Mensajes recientes
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 hace 15 años.

RE: Add portlet above navigation header

Liferay Master Mensajes: 722 Fecha de incorporación: 19/12/07 Mensajes recientes
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?

Archivos adjuntos:

thumbnail
Ray Augé, modificado hace 15 años.

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

Liferay Legend Mensajes: 1197 Fecha de incorporación: 8/02/05 Mensajes recientes
> 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 hace 15 años.

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

New Member Mensajes: 4 Fecha de incorporación: 5/08/08 Mensajes recientes
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 hace 15 años.

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

Regular Member Mensajes: 179 Fecha de incorporación: 25/09/07 Mensajes recientes
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 hace 15 años.

RE: Add portlet above navigation header

New Member Mensaje: 1 Fecha de incorporación: 9/11/08 Mensajes recientes
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 hace 11 años.

RE: Add portlet above navigation header

New Member Mensaje: 1 Fecha de incorporación: 6/08/12 Mensajes recientes
Just want to say thank you for the code and advice on the post. Got some great advice.



___________________
Payment gateway
thumbnail
Daniel Bleisteiner, modificado hace 15 años.

RE: Add portlet above navigation header

New Member Mensajes: 16 Fecha de incorporación: 17/06/08 Mensajes recientes
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 hace 15 años.

RE: Add portlet above navigation header

New Member Mensajes: 16 Fecha de incorporación: 17/06/08 Mensajes recientes
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 hace 15 años.

RE: Add portlet above navigation header

New Member Mensajes: 13 Fecha de incorporación: 12/10/08 Mensajes recientes
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 hace 15 años.

RE: Add portlet above navigation header

Expert Mensajes: 252 Fecha de incorporación: 14/07/08 Mensajes recientes
what about language portlet? and how do i set it's display style to short text?

thanks
thumbnail
Sebastián Gurin, modificado hace 14 años.

RE: Add portlet above navigation header

Junior Member Mensajes: 75 Fecha de incorporación: 13/06/07 Mensajes recientes
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 hace 15 años.

RE: Add portlet above navigation header

Expert Mensajes: 252 Fecha de incorporación: 14/07/08 Mensajes recientes
Michal, could you explain more details please
thumbnail
delang j, modificado hace 15 años.

RE: Add portlet above navigation header

Expert Mensajes: 252 Fecha de incorporación: 14/07/08 Mensajes recientes
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 hace 14 años.

RE: Add portlet above navigation header

Junior Member Mensajes: 75 Fecha de incorporación: 13/06/07 Mensajes recientes
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 hace 12 años.

RE: Add portlet above navigation header

New Member Mensajes: 9 Fecha de incorporación: 6/06/11 Mensajes recientes
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 hace 12 años.

RE: Add portlet above navigation header

New Member Mensajes: 9 Fecha de incorporación: 6/06/11 Mensajes recientes
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 hace 11 años.

RE: Add portlet above navigation header

Regular Member Mensajes: 119 Fecha de incorporación: 5/12/08 Mensajes recientes
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 .