Pages

Thursday, 12 April 2012

Macros Variables/Methods

Macros
Variables/Methods

Theme specific variablesShow

$theme_display
The theme display object


$portlet_display
The portlet display object


$css_class
The css class specified for the "color scheme" in the liferay-look-and-feel.xml


$css_folder
The absolute path to the css directory


$images_folder
The absolute path to the images directory


$javascript_folder
The absolute path to the javascript directory


$templates_folder
The absolute path to the templates directory


$full_css_path
The absolute path to the css directory


$full_templates_path
The absolute path to the templates directory


$css_main_file
The absolute path to the css/main.css file


$js_main_file
The absolute path to the javascript/javascript.js file



Company specific variablesShow

$company_id
The company id (specified in Admin Portlet > Settings)


$company_name
The name of the company (specified in Admin Portlet > Settings)


$company_logo
The absolute path to the image of the company logo (specified in Admin Portlet > Settings)


$company_url
The URL of the company (specified in the Admin Portlet > Settings)



User specific variablesShow

$user_greeting
The greeting that the user get's upon page visit (specfied in My Account or Admin > Users)


$user_email_address
The user's email address (specfied in My Account or Admin > Users)


$user_id
The user's id (set in My Account)


$language_id
The ID of the user's language (specfied in My Account or Admin > Users)


$time_zone
The users's time zone (specfied in My Account)


$user_comments
The comments related to the user (specfied in My Account or Admin > Users)


$user_login_ip
The IP address that the user is currently logged on from


$user_last_login_ip
The last IP address the user logged on from


$is_default_user
A boolean that specifies if the current user is the default one


$user_location
The user's location


$user_organization
The user's organization


$user_group
The group that the user belongs to


$user_birthday
The user's birthday


$is_male
A boolean that specifies if the user is male


$is_female
A boolean that specifies if the user is female


$user_name
The user's full name


$user_first_name
The user's first name


$user_middle_name
The user's middle name (if any)


$user_last_name
The user's last name



Dock specific variablesShow

$show_add_content
Boolean set to specify that the add content link can be displayed


$add_content_text
The text that gets displayed if the add content link is enabled


$add_content_url
The url where the add content link points to


$layout_text
The text to be displayed for the "Change Layout" link


$layout_url
The url where the "Change Layout" link points to


$show_home
Boolean set to specify that the "Home" link can be displayed


$home_text
The text to be displayed for the "Home" link


$home_url
The url where the "Home" link points to


$show_my_account
Boolean set to specify that the "My Account" link can be displayed


$my_account_text
The text to be displayed for the "My Account" link


$my_account_url
The url where the "My Account" link points to


$show_page_settings
Boolean set to specify that the "Page Settings" link can be displayed


$page_settings_text
The text to be displayed for the "Page Settings" link


$page_settings_url
The url where the "Page Settings" link points to


$show_sign_in
Boolean set to specify that the "Sign In" link can be displayed


$sign_in_text
The text to be displayed for the "Sign In" link


$sign_in_url
The url where the "Sign In" link points to


$show_sign_out
Boolean set to specify that the "Sign Out" link can be displayed


$sign_out_text
The text to be displayed for the "Sign Out" link


$sign_out_url
The url where the "Sign Out" link points to



Page specific variablesShow

$selectable
A boolean set that specifies whether a page is "selectable", meaning is it part of the navigation


$page
The current page/layout object


$the_title
The current title of the page



Navigation specific variablesShow

$nav_items
An object that contains all of the pages that are part of the navigation. To set the styling for each navigation item, you must loop through the $nav_items object with a #foreach.


$has_navigation
A boolean set to whether or not there are any pages in the $nav_items object



These methods exist on each sub-object eg. when you're looping through the $nav_items object, you would do $foreach ($nav_item in $nav_items) and you would call $nav_item.METHOD_NAME()


isSelected()
This returns a boolean that indicates whether a navigation item is currently selected.


getURL()
This returns a string that contains the navigation item's URL.


getTarget()
This returns a string that contains the navigation item's target (as defined in the Page Settings).


getName()
This returns a string that contains the navigation item's page name.


hasChildren()
This returns a boolean that indicates whether a navigation item has children.


getChildren()
This returns an object that is has the same methods and variables as the $nav_items object, but contains the current navigation item's children pages.



Misc variablesShow

$update_available_url
The url where the "Update Available" link points to


Utility macrosShow


What's a macro?
A macro is a function that does text manipulation inside of Velocity. You can feed it parameters, and it will print out a string for you. Macros are not like traditional methods or functions, in that they don't return data, and while they can manipulate text based upon the parameters you pass in, it can only print.


#css(FILE_NAME)
Creates a link element like so:
<link href="FILE_NAME" rel="stylesheet" type="text/stylesheet" />

#js(FILE_NAME)
Creates a script element like so:
<script src="FILE_NAME" type="text/javascript"></script>

#language(LANGUAGE_KEY) Prints out the language string related to the LANGUAGE_KEY.
This replaces the following functionality:
$languageUtil.get($company.getCompanyId(), $locale, LANGUAGE_KEY)

No comments:

Post a Comment