Foren
Velocity Variables and Methods list
Nikos Kapatos, geändert vor 14 Jahren.
Velocity Variables and Methods list
Junior Member Beiträge: 57 Beitrittsdatum: 12.11.08 Neueste Beiträge
Where I can find a full list of variables and methods used from liferay velocity?
I've found an html page having some of them but i couldn't find the var "$user " or the method "getMyPlaces()" for example.
I've google it in any possible way and searched the forums lot of time with no luck.
I've found an html page having some of them but i couldn't find the var "$user " or the method "getMyPlaces()" for example.
I've google it in any possible way and searched the forums lot of time with no luck.
Lari Tuominen, geändert vor 14 Jahren.
RE: Velocity Variables and Methods list
Expert Beiträge: 283 Beitrittsdatum: 07.11.07 Neueste Beiträge
Check from Liferay trunk: VelocityVariables.java (if you don't have trunk you can also find it from google).
Also check this article from wiki: http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Which+classes+are+automatically+available+from+a+velocity+template
- Lari
Also check this article from wiki: http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Which+classes+are+automatically+available+from+a+velocity+template
- Lari
Nikos Kapatos, geändert vor 14 Jahren.
RE: Velocity Variables and Methods list
Junior Member Beiträge: 57 Beitrittsdatum: 12.11.08 Neueste Beiträge
Thanx for your time and help.
From the link u provided
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Which+classes+are+automatically+available+from+a+velocity+template
says to look the "portal-impl/src/com/liferay/portal/velocityVelocityVariables.java " but I can't find where this file is.
I searched all folders one by one and i found the porta-impl.jar.
The problem is that the path is "portal-impl/com/liferay/portal/velocityVelocityVariables.class" (no src/) and when i try to open it, it says "cannot open, no sources".
Anyway from that page it has a link to
"http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/How%20To%20Access%20Objects%20From%20A%20Velocity%20Template"
Which has all (not sure if all cause i can't check it) objects.
Now there r 2 problems
First problem is that in the first link it has an example " $layout.getName() ".
The problem in this is the .getName() now that we have a complete (I hope) list of objects.
Based on the example we know that there is a ".getName()" but is there something else?
Like ".setName()", or ".helloWorld()".
If yes is there a way to have a list?
R these for the "$layout" only?
Can be used with other objects?
The second problem is that after all the googling i found a page named "Theme Variables Documentation" which unfortunately i didn't kept the url but i have a print of it.
In this page under the "User Specific variables" it has "$user_login_ip", which is something I can't find in the second link with all the objects, and unfortunately this makes things even more complicated than they r now.
* NOTE *
1st link is "http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Which+classes+are+automatically+available+from+a+velocity+template"
2nd link is "http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/How%20To%20Access%20Objects%20From%20A%20Velocity%20Template"
***********
Thanx for the brave ones who read all this and double thanx those who will dare to answer
From the link u provided
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Which+classes+are+automatically+available+from+a+velocity+template
says to look the "portal-impl/src/com/liferay/portal/velocityVelocityVariables.java " but I can't find where this file is.
I searched all folders one by one and i found the porta-impl.jar.
The problem is that the path is "portal-impl/com/liferay/portal/velocityVelocityVariables.class" (no src/) and when i try to open it, it says "cannot open, no sources".
Anyway from that page it has a link to
"http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/How%20To%20Access%20Objects%20From%20A%20Velocity%20Template"
Which has all (not sure if all cause i can't check it) objects.
Now there r 2 problems
First problem is that in the first link it has an example " $layout.getName() ".
The problem in this is the .getName() now that we have a complete (I hope) list of objects.
Based on the example we know that there is a ".getName()" but is there something else?
Like ".setName()", or ".helloWorld()".
If yes is there a way to have a list?
R these for the "$layout" only?
Can be used with other objects?
The second problem is that after all the googling i found a page named "Theme Variables Documentation" which unfortunately i didn't kept the url but i have a print of it.
In this page under the "User Specific variables" it has "$user_login_ip", which is something I can't find in the second link with all the objects, and unfortunately this makes things even more complicated than they r now.
* NOTE *
1st link is "http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Which+classes+are+automatically+available+from+a+velocity+template"
2nd link is "http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/How%20To%20Access%20Objects%20From%20A%20Velocity%20Template"
***********
Thanx for the brave ones who read all this and double thanx those who will dare to answer
Amos Fong, geändert vor 14 Jahren.
RE: Velocity Variables and Methods list
Liferay Legend Beiträge: 2047 Beitrittsdatum: 07.10.08 Neueste Beiträge
Hey Nikos,
You'll want to download the Liferay source code so it's easier to research this further. In the first example, layout is a java class, and if you look in the source code, you'll see all the methods available to it. (ie setName())
For your second issue, that variable is set in init.vm. You should be able to look at this file in docroot/html/themes/unstyled/templates
These are basically preset variables for use only in themes.
You'll want to download the Liferay source code so it's easier to research this further. In the first example, layout is a java class, and if you look in the source code, you'll see all the methods available to it. (ie setName())
For your second issue, that variable is set in init.vm. You should be able to look at this file in docroot/html/themes/unstyled/templates
These are basically preset variables for use only in themes.
Nikos Kapatos, geändert vor 14 Jahren.
RE: Velocity Variables and Methods list
Junior Member Beiträge: 57 Beitrittsdatum: 12.11.08 Neueste Beiträge
And finally the puzzle solved
Thanx both of u for your time and help.
Thanx both of u for your time and help.
Victor Zorin, geändert vor 14 Jahren.
RE: Velocity Variables and Methods list
Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
It looks like there is always a bit of effort required to get information related to velocity variables. Various manuals are not always up to date.
To make external developers life a bit easier, I have moved own Velocity Variables Explorer from private to public manual pages.
For security reasons, you will not be able to see actual values of those variables without being logged in, but it still produces a lot of useful information. At least it is always up-to-date.
To make external developers life a bit easier, I have moved own Velocity Variables Explorer from private to public manual pages.
For security reasons, you will not be able to see actual values of those variables without being logged in, but it still produces a lot of useful information. At least it is always up-to-date.
Nikos Kapatos, geändert vor 14 Jahren.
RE: Velocity Variables and Methods list
Junior Member Beiträge: 57 Beitrittsdatum: 12.11.08 Neueste BeiträgeVictor Zorin:
It looks like there is always a bit of effort required to get information related to velocity variables. Various manuals are not always up to date.
To make external developers life a bit easier, I have moved own Velocity Variables Explorer from private to public manual pages.
For security reasons, you will not be able to see actual values of those variables without being logged in, but it still produces a lot of useful information. At least it is always up-to-date.
OMG
I just saw your post and my friend and this is unbelievable. Many many thanx for that link and I believe lot of ppl will be happy with that link.
Thanx again
Victor Zorin, geändert vor 14 Jahren.
RE: Velocity Variables and Methods list
Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
Thanks Nikos. That's very encouraging. We make sure that it is improving in terms of usability and data access.
Another type of explorer will be moved into public spot soon.
Another type of explorer will be moved into public spot soon.
Thomas Kellerer, geändert vor 14 Jahren.
RE: Velocity Variables and Methods list
Expert Beiträge: 490 Beitrittsdatum: 09.06.08 Neueste BeiträgeVictor Zorin:
To make external developers life a bit easier, I have moved own Velocity Variables Explorer from private to public manual pages.
Thanks, very nice.
Unfortunately it does not list all Velocity variables. Inside a theme there are e.g. $full_templates_path, $nav_items, $css_main_file, $show_home, $show_page_settings, and a lot more
Are you planning to include those as well at some point in time?
Nikos Kapatos, geändert vor 14 Jahren.
RE: Velocity Variables and Methods list
Junior Member Beiträge: 57 Beitrittsdatum: 12.11.08 Neueste Beiträge
Hi Thomas
These r custom variables that can be found in init.vm file inside your webapps/ROO/\html/themes/_unstyled/templates folder.
EDIT: Not sure if the path is the same for all packages but this path is for tomcat bundle
These r custom variables that can be found in init.vm file inside your webapps/ROO/\html/themes/_unstyled/templates folder.
EDIT: Not sure if the path is the same for all packages but this path is for tomcat bundle
Brandt Solovij, geändert vor 11 Jahren.
RE: Velocity Variables and Methods list
New Member Beiträge: 14 Beitrittsdatum: 23.03.12 Neueste Beiträge
@Nikos Kapatos --- SUPER HELPFUL POST!!!!
I was scratching my head where some of the variables and methods originated and your post helped me a lot.
Topic necromancy aside, I am curious on performance issues with using logic within the vm templating space? Does anyone have any insight on how much or how little active programming should be entertained with the velocity templates? Thanks in advance
I was scratching my head where some of the variables and methods originated and your post helped me a lot.
Topic necromancy aside, I am curious on performance issues with using logic within the vm templating space? Does anyone have any insight on how much or how little active programming should be entertained with the velocity templates? Thanks in advance
Victor Zorin, geändert vor 14 Jahren.
RE: Velocity Variables and Methods list
Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
Thanks Thomas, well add those items by the end of this week.
Also, we expect to push to public use another explorer portlet, this one will provide digging capability for an entire set of Liferay Services API. Hope it will also be very useful.
Also, we expect to push to public use another explorer portlet, this one will provide digging capability for an entire set of Liferay Services API. Hope it will also be very useful.
Ram Mugalipoo, geändert vor 8 Jahren.
RE: Velocity Variables and Methods list
New Member Beiträge: 5 Beitrittsdatum: 02.07.15 Neueste Beiträge
I found a link http://www.liferay.com/community/wiki/-/wiki/Main/CMS+Template+%28Velocity%29#section-CMS+Template+(Velocity)-From+VelocityVariables
where the velocity variables are listed out.
where the velocity variables are listed out.