First we need to create a hook .Here we create Hook by name example-hook
Steps for creating hook
1) New Liferay Plugin Project give the project name as example-hook
2) Select plugin type Hook
3)Finish
Now we will modify your portal’s Terms of Use page.
1)Open the
2)Select the Custom JSPs folder from the outline to bring up the custom JSP options. Select the checkbox Customize Liferay Portal JSPs and create the default custom JSP folder
3)Add to the listing of custom JSPs by clicking the plus icon and specifying Portal’s
4) Save it
5)Open your hook’s
Steps for creating hook
1) New Liferay Plugin Project give the project name as example-hook
2) Select plugin type Hook
3)Finish
Now we will modify your portal’s Terms of Use page.
1)Open the
liferay-hook.xml
file from your project’s docroot/WEB-INF
folder in Liferay IDE2)Select the Custom JSPs folder from the outline to bring up the custom JSP options. Select the checkbox Customize Liferay Portal JSPs and create the default custom JSP folder
/META- INF/custom_jsps
, by clicking the icon that has the three yellow diamonds.3)Add to the listing of custom JSPs by clicking the plus icon and specifying Portal’s
html/portal/terms_of_use.jsp
file. Hint, the browse icon on the right-hand side within the custom
JSP text field simplifies finding the JSP you want to customize. It lets
you scroll through the JSPs that are accessible and lets you specify
key words to narrow your search.4) Save it
5)Open your hook’s
docroot/META-INF/custom_jsps/html/portal/terms_of_use.jsp
file and modify it as you want.
Note, lots of errors will show in the editor because the resources used in the JSP (e.g.,
PortalUtil
)
are not available in the project; but they’ll be available from the
portal once the hook plugin is deployed to the portal server.
6)Deploy your hook and wait until it is deployed successfully.
7)Create a new user and log in. The Terms of Use page should include the changes you made above.
NOTE
Now there are two Terms of Use JSP files in the
NOTE
Now there are two Terms of Use JSP files in the
liferay-portal-[version]/tomcat-[tomcat-version]/webapps/ROOT/html/portal
directory. One is called terms_of_use.jsp
and another terms_of_use.portal.jsp
. terms_of_use.jsp
is your hook’s version, while terms_of_use.portal.jsp
is the original. To revert back to the original, undeploy your hook. Your replacement JSP is removed, and the .portal.jsp
file is automatically renamed, taking its place. You can override any
JSP in the Liferay core, while retaining thew ability to easily revert
your changes. However, it’s not possible to override the same JSP from
multiple hooks; Liferay won’t know which version to use.
No comments:
Post a Comment