掲示板

How to add web content in to theme (portal_normal.vm)

10年前 に Muthu RP によって更新されました。

How to add web content in to theme (portal_normal.vm)

New Member 投稿: 17 参加年月日: 13/05/02 最新の投稿
Dear friends...

I wanted to add a web content into theme(portal_normal.vm), and i tried with two way which i saw from the forum but it's not working, showing like ( This portlet has been undeployed. Please redeploy it or remove it from the page. )

1. $theme.runtime("11003")

2. $velocityPortletPreferences.setValue("portlet-setup-show-borders", "false")
$theme.runtime("11003", "", $velocityPortletPreferences.toString())
$velocityPortletPreferences.reset()

i tried both ways but not working pls help me............................
thumbnail
10年前 に Tejas Kanani によって更新されました。

RE: How to add web content in to theme (portal_normal.vm)

Liferay Master 投稿: 654 参加年月日: 09/01/06 最新の投稿
Which portlet are you trying to add in Theme ? PortletId for web content display portlet is "56" and not "11003"
Try below code.

#set ($VOID = $velocityPortletPreferences.setValue('portletSetupShowBorders', 'false'))
#set ($portlet_id = '56')
$theme.runtime($portlet_id , "", $velocityPortletPreferences.toString())
$velocityPortletPreferences.reset()


Thanks,
Tejas
10年前 に Muthu RP によって更新されました。

RE: How to add web content in to theme (portal_normal.vm)

New Member 投稿: 17 参加年月日: 13/05/02 最新の投稿
Thanks for reply

I made a structure and template in that i am going to keep my webcontent, that web content should reflect all the pages, for that i made a plan to bring my web content to my theme of portal_normal.vm, and i thought was ( $theme.runtime( 'webcontent ID') ) if we add in the portal_normal.vm it will reflect all the pages. but not working, this code also i referd from a forum,

this is my webcontent ID =11003
now what i need to do please kindly guide me.............

Thanks in Advance
Muthu
thumbnail
10年前 に Tejas Kanani によって更新されました。

RE: How to add web content in to theme (portal_normal.vm)

Liferay Master 投稿: 654 参加年月日: 09/01/06 最新の投稿
If you can share you structure & template it will be helpful.
10年前 に Muthu RP によって更新されました。

RE: How to add web content in to theme (portal_normal.vm)

New Member 投稿: 17 参加年月日: 13/05/02 最新の投稿
This is Structure ID : 16801 Here field name is dropdown-listbox with HTML Type
This is Template ID : 16803 here i am getting the value from structure ( $dropdown-listbox.getData())
This is Web content ID : 16806 here i am adding the list content (exp Lin1, Link2, Link3 etc......with Copyright text) but this links is we are adding dynamically

This web content i want to display in footer of my theme portal_normal.vm, for that i have added the code ( $theme.runtime("16806 ") ) in footer section but it is not showing.
thumbnail
10年前 に Tejas Kanani によって更新されました。

RE: How to add web content in to theme (portal_normal.vm)

Liferay Master 投稿: 654 参加年月日: 09/01/06 最新の投稿
It looks like you want to add specific web content in web content display portlet embedded in liferay theme footer.
For that embedding web content display portlet inside theme footer remains same. Only thing that needs to be added is to provide the articleId of web content that you want to display. I guess below code should work for you. I've added '16806' as articleId value in below snippet.


#set ($VOID = $velocityPortletPreferences.setValue('groupId', $themeDisplay.getScopeGroupId().toString()))
#set ($VOID = $velocityPortletPreferences.setValue('articleId', '16806'))
#set ($VOID = $velocityPortletPreferences.setValue('portletSetupShowBorders', 'false'))
#set ($portlet_id = '56')
#set ($my_portlet_id = "${portlet_id}_INSTANCE_1234")
$theme.runtime($my_portlet_id, "", $velocityPortletPreferences.toString())
$velocityPortletPreferences.reset()


In case above code won't work for first try, you need to change its instance value(1234). Just make changed to something else than the existing one, otherwise change won't reflect and you will think your change is not working.

I hope above code will give some idea about what you need.

Thanks,
Tejas
10年前 に Muthu RP によって更新されました。

RE: How to add web content in to theme (portal_normal.vm)

New Member 投稿: 17 参加年月日: 13/05/02 最新の投稿
Thank you very much,

I am trying with this code and let you know....

This code i need to insert in to footer section of my theme of portal_normal.vm file right?

Muhtu
thumbnail
10年前 に Tejas Kanani によって更新されました。

RE: How to add web content in to theme (portal_normal.vm)

Liferay Master 投稿: 654 参加年月日: 09/01/06 最新の投稿
You need to put that code in your theme velocity file(vm) where exactly you want to add your web content.
10年前 に Muthu RP によって更新されました。

RE: How to add web content in to theme (portal_normal.vm)

New Member 投稿: 17 参加年月日: 13/05/02 最新の投稿
Hi Tejas Kanani
Thank you very very much..
Finally It is working fine.................


Thanks
10年前 に Muthu RP によって更新されました。

RE: How to add web content in to theme (portal_normal.vm)

New Member 投稿: 17 参加年月日: 13/05/02 最新の投稿
Hi

I have added this code in my theme footer section it working fine,

And the same way i have to do for the header also for that i have copied same code which you have send me and pasted it in header and only i changed article id ( #set ($VOID = $velocityPortletPreferences.setValue('articleId', '16935')) ) this is correct or not? . but its not working, and same footer content is printing there in header but what i want is not comming.

Pls guide me......................

Thanks
Muthu
thumbnail
10年前 に Tejas Kanani によって更新されました。

RE: How to add web content in to theme (portal_normal.vm)

Liferay Master 投稿: 654 参加年月日: 09/01/06 最新の投稿
If you want to put two different instance of web content display portlet on same page and want to display different web content on it, You'll need to modify its instance id.
So make sure value for instance id in header and footer is different.
#set ($my_portlet_id = "${portlet_id}_INSTANCE_1234")

If you have used _INSTANCE_1234 in header then use _INSTANCE_5678 in footer code.

This should resolve your issue.

Thanks,
Tejas
10年前 に Muthu RP によって更新されました。

RE: How to add web content in to theme (portal_normal.vm)

New Member 投稿: 17 参加年月日: 13/05/02 最新の投稿
Dear Tejas Kanani

Both Header and footer web content is working fine in theme.

Thank & Regards
Muthu
thumbnail
10年前 に Tejas Kanani によって更新されました。

RE: How to use alloy UI Step by step

Liferay Master 投稿: 654 参加年月日: 09/01/06 最新の投稿
Muthu RP,
This is a different question than the one is mentioned in header for this thread.
I would request you not to use same thread for different question. It will help people to find the resolution of respective issues.
You can create your alloy ui question under alloy-ui category to get better/fast replies.
10年前 に Muthu RP によって更新されました。

RE: How to add web content in to theme (portal_normal.vm)

New Member 投稿: 17 参加年月日: 13/05/02 最新の投稿
Hi Tejas Kanani

is it possible to insert one web content (article) inside another web content....pls

This Header Web content

Web content 1 this is for Header
<pre>
<div id="search-container">
#set ($VOID = $velocityPortletPreferences.setValue('groupId', $themeDisplay.getScopeGroupId().toString()))
#set ($VOID = $velocityPortletPreferences.setValue('articleId', '17185'))
#set ($VOID = $velocityPortletPreferences.setValue('portletSetupShowBorders', 'false'))
#set ($portlet_id = '56')
#set ($my_portlet_id = "${portlet_id}_INSTANCE_7654")
$theme.runtime($my_portlet_id, "", $velocityPortletPreferences.toString())
</div>
</pre>

Web content 2 this is for search
<pre>
<div id="search-container">
#set ($VOID = $velocityPortletPreferences.setValue('groupId', $themeDisplay.getScopeGroupId().toString()))
#set ($VOID = $velocityPortletPreferences.setValue('articleId', '17185'))
#set ($VOID = $velocityPortletPreferences.setValue('portletSetupShowBorders', 'false'))
#set ($portlet_id = '56')
#set ($my_portlet_id = "${portlet_id}_INSTANCE_7654")
$theme.runtime($my_portlet_id, "", $velocityPortletPreferences.toString())
</div>
</pre>

Here are they my two web content, i want to insert the search web content inside the header web content.................

pls guid me



Thanks
Muthu
thumbnail
10年前 に Tejas Kanani によって更新されました。

RE: How to add web content in to theme (portal_normal.vm)

Liferay Master 投稿: 654 参加年月日: 09/01/06 最新の投稿
Well, that code will add web content display portlet instance and will display web content inside that portlet.
There is another way by which you can just display the actual content as html of selected web content.
So you can add 1st web content using your code,

<pre>
<div id="search-container">
#set ($VOID = $velocityPortletPreferences.setValue('groupId', $themeDisplay.getScopeGroupId().toString()))
#set ($VOID = $velocityPortletPreferences.setValue('articleId', '17185'))
#set ($VOID = $velocityPortletPreferences.setValue('portletSetupShowBorders', 'false'))
#set ($portlet_id = '56')
#set ($my_portlet_id = "${portlet_id}_INSTANCE_7654")
$theme.runtime($my_portlet_id, "", $velocityPortletPreferences.toString())
</div>
</pre>


And second web content you can just display the actual content of it. using below code.
#set ($actualContentAsHtml= $journalArticleLocalService.getLatestArticleByUrlTitle($themeDisplay.getScopeGroupId().toString(), $webContentURLTitle, 0))


So it would something looks like,
<pre>
<div id="search-container">
#set ($VOID = $velocityPortletPreferences.setValue('groupId', $themeDisplay.getScopeGroupId().toString()))
#set ($VOID = $velocityPortletPreferences.setValue('articleId', '17185'))
#set ($VOID = $velocityPortletPreferences.setValue('portletSetupShowBorders', 'false'))
#set ($portlet_id = '56')
#set ($my_portlet_id = "${portlet_id}_INSTANCE_7654")
$theme.runtime($my_portlet_id, "", $velocityPortletPreferences.toString())
</div>
</pre>

## 2nd Web Content
#set ($webContentTitle = "<your-web-content-name>")
#set ($webContentURLTitle = $stringUtil.replace($stringUtil.lowerCase("$webContentTitle"),' ','-'))
#set ($actualContentAsHtml= $journalArticleLocalService.getLatestArticleByUrlTitle($themeDisplay.getScopeGroupId().toString(), $webContentURLTitle, 0))

<div>
<p>$actualContentAsHtml</p>
</div>
</your-web-content-name>


Just replace <your-web-content-name> by your actual web content name(not articleId).

Try this out it might work.

Thanks,
Tejas
thumbnail
9年前 に Jose Jimenez によって更新されました。

RE: How to add web content in to theme (portal_normal.vm)

Regular Member 投稿: 176 参加年月日: 12/08/23 最新の投稿
Hi all, it isn't neccesary to embed a portlet to display a web content, the simplest way (in 6.2):

$theme.journalArticle($articleId, $themeDisplay.getSiteGroupId(), “”)

Best regards.
8年前 に Kavishankar K によって更新されました。

$theme.journalArticle($articleId, $themeDisplay.getSiteGroupId(), “”)

New Member 投稿: 1 参加年月日: 13/06/20 最新の投稿
Hi Joes,
Its looks very simple to code and its working great !! Thanks a lot for your contribution and for Lifreay 6.2 $theme update too.. emoticon
-Kavi
thumbnail
8年前 に Gabriel Bustos Padilla によって更新されました。

RE: $theme.journalArticle($articleId, $themeDisplay.getSiteGroupId(), “”)

Junior Member 投稿: 63 参加年月日: 13/03/06 最新の投稿
there is some method to not to use ArticleID? My problem is that when I export webcontent to other portal, ArticleID it changes and then this method does not work
thumbnail
8年前 に Meera Prince によって更新されました。

RE: How to add web content in to theme (portal_normal.vm)

Liferay Legend 投稿: 1111 参加年月日: 11/02/08 最新の投稿
HI
Article Id you can pass using theme setting so that when it changed you can update it .

Regards,
Meera Prince
thumbnail
8年前 に Gabriel Bustos Padilla によって更新されました。

RE: How to add web content in to theme (portal_normal.vm)

Junior Member 投稿: 63 参加年月日: 13/03/06 最新の投稿
Thanks!! Yes, until now I have used this method but I would like to know if there is a id that does not change with the export to avoid change values in settings of the theme