Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Siju Thomas
how to show custom theme variables stored in the init_custom.vm in jsp
January 16, 2013 2:58 AM
Answer

Siju Thomas

Rank: New Member

Posts: 4

Join Date: July 27, 2011

Recent Posts

#set ($companyName = "shark")
#set ($companyUrl = "http://www.shark.com")
#set ($companyEmail = "info@shark.com")
this is my custom variables saved in init_custom.vm . How to show this vm variable values in my login.jsp in Hook.
I am using below code and its not working
Welcome to the <%=themeDisplay.companyName%>
Olaf Kock
RE: how to show custom theme variables stored in the init_custom.vm in jsp
January 20, 2013 2:30 PM
Answer

Olaf Kock

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2042

Join Date: September 23, 2008

Recent Posts

You'll have to understand that init.vm (or init_custom.vm) just initializes what is available to velocity when interpreting the theme - it does not modify what is happening in the backend, e.g. it's not going back to what is available from the API (as is themeDisplay)

My advice would be to just set the companyName, URL and Mail through ControlPanel, Portal Section, "Portal Settings". In case you have definitive needs to customize them when your theme is active, you should go either through theme properties like this:
1<%=themeDisplay.getThemeSettings().getProperty("my-custom-information") %>
or alternatively use the API to change the globally available company data (in case you want that).

You can even make them configurable if you add them to your theme:

 1    <theme id="classic" name="Classic">
 2        <root-path>/html/themes/classic</root-path>
 3        <templates-path>${root-path}/templates</templates-path>
 4        <images-path>${root-path}/images</images-path>
 5        <template-extension>vm</template-extension>
 6        <settings>
 7            <setting configurable="true" key="my-custom-information" value="Whatever default you'd like" />
 8        </settings>
 9    </theme>
Siju Thomas
RE: how to show custom theme variables stored in the init_custom.vm in jsp
January 21, 2013 1:24 AM
Answer

Siju Thomas

Rank: New Member

Posts: 4

Join Date: July 27, 2011

Recent Posts

Thank you Olaf