Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Get unique ID of the asset publisher
I have 3 asset publisher inside a page, and I have to manage some javascript interaction.
In my freemarker widget template I need a unique ID to use in my js in order to know exactly which of the 3 asset publisher I am controlling, as you can do with fragments.
How can I print it out?
Hi,
You can use the portlet instance id for referring each asset publisher on the page.
${themeDisplay.getPortletDisplay().getId()}
or
${themeDisplay.getPortletDisplay().getInstanceId()}
Thank you,
This is how I used it, for the sake of readability
<#assign portlet_id = themeDisplay.getPortletDisplay().getId() />
<#assign split_id = portlet_id?split("_") />
<#assign el_id = split_id?last />
${el_id}
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™