Forums de discussion

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

Muthu RP, modifié il y a 10 années.

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

New Member Publications: 17 Date d'inscription: 02/05/13 Publications récentes
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
Tejas Kanani, modifié il y a 10 années.

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

Liferay Master Publications: 654 Date d'inscription: 06/01/09 Publications récentes
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
Muthu RP, modifié il y a 10 années.

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

New Member Publications: 17 Date d'inscription: 02/05/13 Publications récentes
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
Tejas Kanani, modifié il y a 10 années.

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

Liferay Master Publications: 654 Date d'inscription: 06/01/09 Publications récentes
If you can share you structure & template it will be helpful.
Muthu RP, modifié il y a 10 années.

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

New Member Publications: 17 Date d'inscription: 02/05/13 Publications récentes
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
Tejas Kanani, modifié il y a 10 années.

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

Liferay Master Publications: 654 Date d'inscription: 06/01/09 Publications récentes
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
Muthu RP, modifié il y a 10 années.

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

New Member Publications: 17 Date d'inscription: 02/05/13 Publications récentes
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
Tejas Kanani, modifié il y a 10 années.

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

Liferay Master Publications: 654 Date d'inscription: 06/01/09 Publications récentes
You need to put that code in your theme velocity file(vm) where exactly you want to add your web content.
Muthu RP, modifié il y a 10 années.

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

New Member Publications: 17 Date d'inscription: 02/05/13 Publications récentes
Hi Tejas Kanani
Thank you very very much..
Finally It is working fine.................


Thanks
Muthu RP, modifié il y a 10 années.

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

New Member Publications: 17 Date d'inscription: 02/05/13 Publications récentes
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
Tejas Kanani, modifié il y a 10 années.

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

Liferay Master Publications: 654 Date d'inscription: 06/01/09 Publications récentes
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
Muthu RP, modifié il y a 10 années.

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

New Member Publications: 17 Date d'inscription: 02/05/13 Publications récentes
Dear Tejas Kanani

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

Thank & Regards
Muthu
thumbnail
Tejas Kanani, modifié il y a 10 années.

RE: How to use alloy UI Step by step

Liferay Master Publications: 654 Date d'inscription: 06/01/09 Publications récentes
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.
Muthu RP, modifié il y a 10 années.

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

New Member Publications: 17 Date d'inscription: 02/05/13 Publications récentes
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
Tejas Kanani, modifié il y a 10 années.

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

Liferay Master Publications: 654 Date d'inscription: 06/01/09 Publications récentes
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
Jose Jimenez, modifié il y a 9 années.

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

Regular Member Publications: 176 Date d'inscription: 23/08/12 Publications récentes
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.
Kavishankar K, modifié il y a 8 années.

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

New Member Envoyer: 1 Date d'inscription: 20/06/13 Publications récentes
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
Gabriel Bustos Padilla, modifié il y a 8 années.

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

Junior Member Publications: 63 Date d'inscription: 06/03/13 Publications récentes
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
Meera Prince, modifié il y a 8 années.

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

Liferay Legend Publications: 1111 Date d'inscription: 08/02/11 Publications récentes
HI
Article Id you can pass using theme setting so that when it changed you can update it .

Regards,
Meera Prince
thumbnail
Gabriel Bustos Padilla, modifié il y a 8 années.

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

Junior Member Publications: 63 Date d'inscription: 06/03/13 Publications récentes
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