掲示板

Velocity Variables and Methods list

thumbnail
14年前 に Nikos Kapatos によって更新されました。

Velocity Variables and Methods list

Junior Member 投稿: 57 参加年月日: 08/11/12 最新の投稿
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.
thumbnail
14年前 に Lari Tuominen によって更新されました。

RE: Velocity Variables and Methods list

Expert 投稿: 283 参加年月日: 07/11/07 最新の投稿
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
thumbnail
14年前 に Nikos Kapatos によって更新されました。

RE: Velocity Variables and Methods list

Junior Member 投稿: 57 参加年月日: 08/11/12 最新の投稿
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
thumbnail
14年前 に Amos Fong によって更新されました。

RE: Velocity Variables and Methods list

Liferay Legend 投稿: 2047 参加年月日: 08/10/07 最新の投稿
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.
thumbnail
14年前 に Nikos Kapatos によって更新されました。

RE: Velocity Variables and Methods list

Junior Member 投稿: 57 参加年月日: 08/11/12 最新の投稿
And finally the puzzle solved

Thanx both of u for your time and help.

emoticon
thumbnail
14年前 に Victor Zorin によって更新されました。

RE: Velocity Variables and Methods list

Liferay Legend 投稿: 1228 参加年月日: 08/04/14 最新の投稿
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.
thumbnail
14年前 に Nikos Kapatos によって更新されました。

RE: Velocity Variables and Methods list

Junior Member 投稿: 57 参加年月日: 08/11/12 最新の投稿
Victor 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 emoticon
thumbnail
14年前 に Victor Zorin によって更新されました。

RE: Velocity Variables and Methods list

Liferay Legend 投稿: 1228 参加年月日: 08/04/14 最新の投稿
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.
14年前 に Thomas Kellerer によって更新されました。

RE: Velocity Variables and Methods list

Expert 投稿: 490 参加年月日: 08/06/09 最新の投稿
Victor 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?
thumbnail
14年前 に Nikos Kapatos によって更新されました。

RE: Velocity Variables and Methods list

Junior Member 投稿: 57 参加年月日: 08/11/12 最新の投稿
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
thumbnail
11年前 に Brandt Solovij によって更新されました。

RE: Velocity Variables and Methods list

New Member 投稿: 14 参加年月日: 12/03/23 最新の投稿
@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
thumbnail
14年前 に Victor Zorin によって更新されました。

RE: Velocity Variables and Methods list

Liferay Legend 投稿: 1228 参加年月日: 08/04/14 最新の投稿
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.
8年前 に Ram Mugalipoo によって更新されました。

RE: Velocity Variables and Methods list

New Member 投稿: 5 参加年月日: 15/07/02 最新の投稿
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.