Foros de discusión

Overring the portal.properties file in Plugin

thumbnail
manasa chandri, modificado hace 11 años.

Overring the portal.properties file in Plugin

Regular Member Mensajes: 152 Fecha de incorporación: 28/09/10 Mensajes recientes
Hi All,

I want to customize the portlet properties in my custom portlet, where i have to write the properties file in plugin environment.

Thanks & Regards,
Manasa.chandri.
thumbnail
David H Nebinger, modificado hace 11 años.

RE: Overring the portal.properties file in Plugin

Liferay Legend Mensajes: 14916 Fecha de incorporación: 2/09/06 Mensajes recientes
You can add a portlet.properties file to your portlet and make necessary changes.

The subject line (overriding portal.properties) is not possible.
thumbnail
manasa chandri, modificado hace 11 años.

RE: Overring the portal.properties file in Plugin

Regular Member Mensajes: 152 Fecha de incorporación: 28/09/10 Mensajes recientes
Hi David H Nebinger,

Thank you for giving reply,
Where i can add the portlet.properties file?
what is use of adding the portlet.properties file?

Thanks & Regards,
Manasa.chandri.
thumbnail
David H Nebinger, modificado hace 11 años.

RE: Overring the portal.properties file in Plugin

Liferay Legend Mensajes: 14916 Fecha de incorporación: 2/09/06 Mensajes recientes
Drop it in the docroot/WEB-INF/src directory and it will get to the portlet's WEB-INF/classes dir at build time.

What is the use of a preferences file? Really? So you don't have to hard-code details in your portlet...
thumbnail
Milen Dyankov, modificado hace 11 años.

RE: Overring the portal.properties file in Plugin (Respuesta)

Regular Member Mensajes: 171 Fecha de incorporación: 23/09/09 Mensajes recientes
David H Nebinger:
The subject line (overriding portal.properties) is not possible.


Strictly speaking this is not true. One can override some single value properties and append to multi-value properties via hooks. See http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/performing-a-custom-acti-4 and http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/extending-and-overriding-%3Cem%3Eportal-properties%3C-e-1 for details!

So if the property you would like to modify is on the list in the liferay-hook-[liferay version].dtd, try to create the file portal.properties inside [YOUR_PORTLET]/docroot/WEB-INF/src and put your changes in it.
Then add liferay-hook.xml inside [YOUR_PORTLET]/docroot/WEB-INF and add the following :

<!--?xml version="1.0"?-->

<hook>
<portal-properties>portal.properties</portal-properties>
</hook>


Of course this is for Liferay 6.1. Adapt the example accordingly for your Liferay version.
thumbnail
David H Nebinger, modificado hace 11 años.

RE: Overring the portal.properties file in Plugin

Liferay Legend Mensajes: 14916 Fecha de incorporación: 2/09/06 Mensajes recientes
Milen is right about some properties being settable in a plugin. Typically these are used to enable something provided by the plugin itself...
thumbnail
manasa chandri, modificado hace 11 años.

RE: Overring the portal.properties file in Plugin

Regular Member Mensajes: 152 Fecha de incorporación: 28/09/10 Mensajes recientes
Hi Milen Dyankov,

Thank you..