Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Siju Thomas
how to show custom theme variables stored in the init_custom.vm in jsp
16 gennaio 2013 2.58
Risposta

Siju Thomas

Punteggio: New Member

Messaggi: 4

Data di Iscrizione: 27 luglio 2011

Messaggi recenti

#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
20 gennaio 2013 14.30
Risposta

Olaf Kock

LIFERAY STAFF

Punteggio: Liferay Legend

Messaggi: 1892

Data di Iscrizione: 23 settembre 2008

Messaggi recenti

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
21 gennaio 2013 1.24
Risposta

Siju Thomas

Punteggio: New Member

Messaggi: 4

Data di Iscrizione: 27 luglio 2011

Messaggi recenti

Thank you Olaf