Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
sangeeth k
how to get pagename in portal_normal.vm file
December 16, 2012 11:41 PM
Answer

sangeeth k

Rank: Regular Member

Posts: 114

Join Date: April 22, 2012

Recent Posts

HI team,

I am working in liferay 6.0.6 C.E,

I want to get page name in VM file,

i have /welcome page...how to get pagename in vm file.
sricanth arroju
RE: how to get pagename in portal_normal.vm file
December 17, 2012 12:52 AM
Answer

sricanth arroju

Rank: Regular Member

Posts: 130

Join Date: October 2, 2009

Recent Posts

you can use $layout.getFriendlyURL() in vm file to get the page name.
Rahul Sharma
RE: how to get pagename in portal_normal.vm file
December 17, 2012 12:59 AM
Answer

Rahul Sharma

Rank: Junior Member

Posts: 60

Join Date: January 10, 2012

Recent Posts

You can write
#set($Pagename=$themeDisplay.getLayout().getName()) in the portal_normal.vm this will set the current page value to the vm variable "$Pagename" and then use this variable by writing "$Pagename" to retrieve the value of the page name.

Regards,
Rahul
sangeeth k
RE: how to get pagename in portal_normal.vm file
December 17, 2012 5:44 AM
Answer

sangeeth k

Rank: Regular Member

Posts: 114

Join Date: April 22, 2012

Recent Posts

Hi Rahul,Srikanth....

Thanks for the reply...
it's very helpful.


Thanks again....
sangeeth k
RE: how to get pagename in portal_normal.vm file
December 20, 2012 5:16 AM
Answer

sangeeth k

Rank: Regular Member

Posts: 114

Join Date: April 22, 2012

Recent Posts

Hi rahul,

 1
 2
 3#set ($Pagename=$themeDisplay.getLayout().getName())
 4
 5 #if($Pagename == "welcome")
 6      
 7       #else
 8                          <h1 class="company-title">
 9                <a class="logo" href="/web/test/home" title="#language("go-to") $company_name">
10                    <img src="$images_folder/logo.jpg" alt="testLogo"/>
11                </a>
12            </h1>
13   #end


I want to hide Logo for welcome page

The above code is correct or not, For hiding logo to welcome page...

Please let me know what the mistake i done.



Thanks
sangeeth k
RE: how to get pagename in portal_normal.vm file
December 31, 2012 3:27 AM
Answer

sangeeth k

Rank: Regular Member

Posts: 114

Join Date: April 22, 2012

Recent Posts

Hi rahul,

How to compare the page name

I tried this
1
2#set ($Pagename=$themeDisplay.getLayout().getName())
3#if($Pagename=="welcome")
4#else
5<a class="logo" href="/web/balaa/home" title="#language("go-to") $company_name">
6                    <img src="$images_folder/logo.jpg" alt="Logo"/>
7#end


The above code is not working for me

where did i done mistake can you please help in this issue.



Thanks
Jitendra Rajput
RE: how to get pagename in portal_normal.vm file
December 31, 2012 3:37 AM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 858

Join Date: January 7, 2011

Recent Posts

Two page can have same name . So try to compare with friendly URL instead of page name.
sangeeth k
RE: how to get pagename in portal_normal.vm file
December 31, 2012 4:42 AM
Answer

sangeeth k

Rank: Regular Member

Posts: 114

Join Date: April 22, 2012

Recent Posts

Hi jitendar,

can you guide me on friendly URL how to do this.



Thanks
Rahul Sharma
RE: how to get pagename in portal_normal.vm file
January 3, 2013 2:31 AM
Answer

Rahul Sharma

Rank: Junior Member

Posts: 60

Join Date: January 10, 2012

Recent Posts

Hi,

You need to use LayoutLocalServiceUtil and to use this, try to develop a code which is iterating all the pages/layouts properties then use the same code in the vm file to do the desired work.

Hope that helps!