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
Liferay 7.3 FreeMarker display username using Web Content template
Version: Liferay 7.3
How do I get Freemarker to display the user's (first) name within Web Content using a custom template?
Use Case: <p>Welcome, ${userName}.</p>
How do I get Freemarker to display the user's (first) name within Web Content using a custom template?
Use Case: <p>Welcome, ${userName}.</p>
Hi , You can try below code
.vars['reserved-article-author-name'].data
.vars['reserved-article-author-name'].data
That's the name of the author, not the name of the current user.
${user.getFirstName()} should work.
Thank you very much.${user.getFirstName()} worked perfectly.
When I search for Liferay 7.3 variables I get different versions of them. Is there a page that has the current list of variable options?
Thanks again.
When I search for Liferay 7.3 variables I get different versions of them. Is there a page that has the current list of variable options?
Thanks again.
There is this for the theme but for templates the documentation is lacking ...https://help.liferay.com/hc/en-us/articles/360032627372-Freemarker-Variable-Reference-Guide
Maybe James' Magic Template Dumper helps - it might need some adaptation for the latest version, but the approach might still work. And then, the information would come from the currently running system, e.g. be accurate and up to date.
I have used this fork recently and it works at least with 7.3.2:
https://gist.github.com/bmvakili/b5d871b4cbc4ebbbe0a0
I think, some issues with the old code were fixed there.
https://gist.github.com/bmvakili/b5d871b4cbc4ebbbe0a0
I think, some issues with the old code were fixed there.
Thanks, everyone.
Just a thought ... This sort of script would be useful to have as a built-in feature. Perhaps a default admin page that can be visited on every virtual instance.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™