掲示板

how can i change portlet title in velocity template?

thumbnail
11年前 に maryam maryam masoudy によって更新されました。

how can i change portlet title in velocity template?

Regular Member 投稿: 149 参加年月日: 11/10/30 最新の投稿
hi
i want to set portlet title in velocity template
i work with liferay6.1
i wrote this code but portlet title didnot change

#set ($myPortletId = "56_INSTANCE_Xmi4S46xzzfL")
$velocityPortletPreferences.setValue("custom-title", "bbbbbbbbb")
$velocityPortletPreferences.setValue("title", "kkkkkkkk")
$velocityPortletPreferences.setValue("portlet-title", "cccccccc")
$theme.runtime($myPortletId, '', $velocityPortletPreferences.toString())
#set ($VOID = $velocityPortletPreferences.reset())




in portlet option >advance, styling portlet id is : Portlet ID: #portlet_56_INSTANCE_Xmi4S46xzzfL
i use 56_INSTANCE_Xmi4S46xzzfL it is corect?
is my velocity corect?
how can i change portlet title in velocity template?
thanks
thumbnail
11年前 に Pavel Savinov によって更新されました。

RE: how can i change portlet title in velocity template?

Junior Member 投稿: 94 参加年月日: 12/09/24 最新の投稿
Hi Maryam.

Try $portletDisplay.setTitle("yourTitleHere");
thumbnail
11年前 に maryam maryam masoudy によって更新されました。

RE: how can i change portlet title in velocity template?

Regular Member 投稿: 149 参加年月日: 11/10/30 最新の投稿
i wrote $portletDisplay.setTitle("yourTitleHere") but in content
shown $portletDisplay.setTitle("yourTitleHere") without any result and my title didnot change
do i write $portletDisplay.setTitle("yourTitleHere") only without anything?
thanks
thumbnail
11年前 に Pavel Savinov によって更新されました。

RE: how can i change portlet title in velocity template?

Junior Member 投稿: 94 参加年月日: 12/09/24 最新の投稿
I've checked it. Unfortunatelly $portletDisplay object is not available in the CMS content templates emoticon
I'll try to find out some other method.
thumbnail
11年前 に maryam maryam masoudy によって更新されました。

RE: how can i change portlet title in velocity template?

Regular Member 投稿: 149 参加年月日: 11/10/30 最新の投稿
ohhh thanks Pavel
but i donot knew what do i do emoticon
thumbnail
11年前 に Nikhil Nishchal によって更新されました。

RE: how can i change portlet title in velocity template?

Regular Member 投稿: 177 参加年月日: 12/06/22 最新の投稿
Pavel Savinov:
I've checked it. Unfortunatelly $portletDisplay object is not available in the CMS content templates emoticon
I'll try to find out some other method.


$portletDisplay object can be get through
$request.get("theme-display").get("portlet-display")

Or
$request.theme-display.portlet-display
thumbnail
11年前 に maryam maryam masoudy によって更新されました。

RE: how can i change portlet title in velocity template?

Regular Member 投稿: 149 参加年月日: 11/10/30 最新の投稿
Hi Nikhil Nishchal thanks for reply
i could get portlet title but now how do i set my title? emoticon
thumbnail
11年前 に Pavel Savinov によって更新されました。

RE: how can i change portlet title in velocity template? (回答)

Junior Member 投稿: 94 参加年月日: 12/09/24 最新の投稿
Maryam, Liferay hack for you emoticon

Put following code into your template text, replace newTitle var value with desired title.

<script>
function updatePortletTitle(children,title) {
    if (children!=null && children.length>0) {
        for (var k=0;k<children.length;k++) {
            if (children[k].className == 'portlet-title-text') {
                children[k].innerHTML = title;
                break;
            }
            if (children[k].childNodes != null &&
                children[k].childNodes.length > 0) {
                updatePortletTitle(children[k].childNodes,title);    
            }
        }
    }
}

var portletId = "portlet_$request.theme-display.portlet-display.id";
var portletSection = document.getElementById(portletId);
var newTitle = "Test Dynamic Title";

updatePortletTitle(portletSection.childNodes,newTitle);
</script>


It works fine on 6.1.1 CE emoticon
thumbnail
11年前 に maryam maryam masoudy によって更新されました。

RE: how can i change portlet title in velocity template?

Regular Member 投稿: 149 参加年月日: 11/10/30 最新の投稿
thanks Pavel
i write this code in velocity template?
thumbnail
11年前 に Pavel Savinov によって更新されました。

RE: how can i change portlet title in velocity template?

Junior Member 投稿: 94 参加年月日: 12/09/24 最新の投稿
maryam maryam masoudy:
thanks Pavel
i write this code in velocity template?


Yes, in the template text.
thumbnail
11年前 に maryam maryam masoudy によって更新されました。

RE: how can i change portlet title in velocity template?

Regular Member 投稿: 149 参加年月日: 11/10/30 最新の投稿
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
Pavel it is correct thanks veryyyyyyyyyyyyyyyyyyyyyyyy much emoticon
thumbnail
11年前 に Alireza Zare によって更新されました。

RE: how can i change portlet title in velocity template? (回答)

Regular Member 投稿: 110 参加年月日: 10/09/03 最新の投稿
The short version:
<script>
AUI().ready(function(A) {
var portletContainer= A.one("#portlet_$request.theme-display.portlet-display.id");
var portletTitle= portletContainer.one(".portlet-title-text");
portletTitle.setContent("News");

});
</script>
thumbnail
11年前 に maryam maryam masoudy によって更新されました。

RE: how can i change portlet title in velocity template?

Regular Member 投稿: 149 参加年月日: 11/10/30 最新の投稿
thanks for reply
thumbnail
9年前 に Muhammad Ghufron によって更新されました。

RE: how can i change portlet title in velocity template?

New Member 投稿: 18 参加年月日: 14/08/08 最新の投稿
Alireza Zare:
The short version:
<script>
AUI().ready(function(A) {
var portletContainer= A.one("#portlet_$request.theme-display.portlet-display.id");
var portletTitle= portletContainer.one(".portlet-title-text");
portletTitle.setContent("News");

});
</script>



thank you very much Alireza Zare,