Featured post

Docker setup for Liferay 7 with MySQL

Thursday, 3 November 2011

Create your own custom tld in Liferay at Portal Level.

If you are here that means you already know what is a TLD(Top Level Definition).
To include a TLD in Liferay at root level or you can say a portal level tld, you can follow the steps which will help you to create one on your own.

1. Create a hook name mytld.
2. Create mytld.jsp at /docroot/web-inf/jsps/html/taglib/ui/mytld/mytld.jsp.
3. Create an ext named mytld ext.
4. Move to web.xml by /docroot/web-inf/ext-web/docroot/web-inf/web.xml in ext.
5. Put below lines in web.xml.

<?xml version="1.0"?>

<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">



6. Create a corresponding java class for ur taglib(if required) at /docroot/web-inf/ext-util-taglib/src/com/liferay/taglib/ui/MyTld.java in ext.
7. Write required code.
8. Move to /docroot/web-inf/ext-web/docroot/web-inf/tld/liferay-fc.tld.
9. Put below lines in liferay-fc.tld.

<?xml version="1.0" encoding="UTF-8"?>


10. Deploy your ext.
11.Deploy your hook.
12.Restart your server.
12.Your new tld is ready to use.

Please let me know, if there is any concern about this Blog.