Foren

Hook custom Taglib

Camilla M., geändert vor 13 Jahren.

Hook custom Taglib

New Member Beiträge: 3 Beitrittsdatum: 09.10.10 Neueste Beiträge
Hi there,

for my current portlet project I developed a custom "calendarType" taglib and I want it to be adapted by the liferay portal as well.

Does anybody know how to "hook" a taglib for the liferay portal source?

Greets
Camilla
thumbnail
Andrés Cerezo, geändert vor 13 Jahren.

RE: Hook custom Taglib

Junior Member Beiträge: 92 Beitrittsdatum: 11.11.10 Neueste Beiträge
Hello, I've the same problem, Did you find the solution?

Cheers.
thumbnail
Patrick NERDEN, geändert vor 11 Jahren.

RE: Hook custom Taglib

New Member Beiträge: 10 Beitrittsdatum: 16.04.10 Neueste Beiträge
Same question here : how can I add a custom taglib through a hook instead of an ext-plugin ?
thumbnail
Nicolas Forney, geändert vor 11 Jahren.

RE: Hook custom Taglib

Junior Member Beiträge: 78 Beitrittsdatum: 23.05.11 Neueste Beiträge
Hello,

Sorry for digging up old post, but I'm asking myself the same question and there is still no answer...

Any idea if it's possible to use hook to overwrite liferay taglibs ? Or isn't it only possible through an ext plugin?

Thx
thumbnail
Nicolas Forney, geändert vor 11 Jahren.

RE: Hook custom Taglib

Junior Member Beiträge: 78 Beitrittsdatum: 23.05.11 Neueste Beiträge
Well, finally it's pretty easy to hook taglibs.

Just create a hook plugin set the following line in the liferay-hook.xml :
<hook>
    <custom-jsp-dir>/META-INF/custom_jsps</custom-jsp-dir>      
</hook>


Then, add the taglib files you want to override inside the custom_jsps folder of your project.
docroot/META-INF/custom_jsps


Let say you want to override the liferay-ui:header, just copy the init.jsp file and the page.jsp located in the Liferay sources into :
 portal-web/docroot/html/taglib/ui/header

and then, copy the files to your project in the following folder :
docroot/META-INF/custom_jsps/html/taglib/ui/header
.

You can now deploy your hook !

I did this with Liferay 6.1
thumbnail
Reigo Reinmets, geändert vor 9 Jahren.

RE: Hook custom Taglib

New Member Beiträge: 4 Beitrittsdatum: 29.07.10 Neueste Beiträge
I had a similar issue but I wanted to create my own custom taglib that I could use in my many different portlet projects and render the JSP's like liferay tags do it. Turns out it's not THAT difficult but does require you to split the Hook and Taglib itself into separate projects so that you could reference the taglib project via Maven during development time and keep Eclipse from complaining.

Here's a short tutorial on how I did it: http://www.codeyouneed.com/how-to-create-a-taglib-with-jsps-for-liferay