Mirto Silvio Busico 6 Years Ago Question: where can I find the accepted definitions for @liferay_frontend?I mean other than vertical-card and vertical-card-footer what are the other options?Where can I find documentation about this?Thanks Reply Reply as... Cancel Eduardo P. Garcia Mirto Silvio Busico 6 Years Ago Hi Mirto,You can find the javadocs for the frontend taglibs here: https://docs.liferay.com/ce/apps/foundation/latest/javadocs/com/liferay/frontend/taglib/.And the TLD is here:https://github.com/liferay/liferay-portal/blob/7.0.x/modules/apps/foundation/frontend-taglib/frontend-taglib/src/main/resources/META-INF/liferay-frontend.tld Reply Reply as... Cancel
Eduardo P. Garcia Mirto Silvio Busico 6 Years Ago Hi Mirto,You can find the javadocs for the frontend taglibs here: https://docs.liferay.com/ce/apps/foundation/latest/javadocs/com/liferay/frontend/taglib/.And the TLD is here:https://github.com/liferay/liferay-portal/blob/7.0.x/modules/apps/foundation/frontend-taglib/frontend-taglib/src/main/resources/META-INF/liferay-frontend.tld Reply Reply as... Cancel
Petr Bodnár 6 Years Ago Hi, thanks for this great article. I'm missing just two important things in it:1) It should have been stated clearly *right in the first paragraph* that this article is not quite applicable to older versions of Liferay, or is it? We haven't found an easy way to do something similar prior to Liferay 7.2) What if one would need to *link to the details of the rendered items* from inside the content rendered by the WC template. We've got the item's page URL available in the AP template, but how can we read it in the called WC template? Reply Reply as... Cancel Orin Fink Petr Bodnár 6 Years Ago For the link to detail, you _could_ put a token (like {{link-to-detail}} ) in the web content article template and then do a replace of that token with the link from the ADT code.The ADT (and the asset entry) give you a little more power to build the detail link so that worked better for us in our case while using a similar approach with velocity in 6.2. Reply Reply as... Cancel Petr Bodnár Orin Fink 6 Years Ago OK, sounds reasonable, thanks for your sharing Reply Reply as... Cancel Eduardo P. Garcia Petr Bodnár 6 Years Ago Hi Petr,1) Certainly, the article contains code examples that are directly applicable only to Liferay 7. But you can achieve this on 6.2, too. In that version, the journal-article taglib was located in the liferay-ui namespace. Thus, you'd have to use liferay_ui["journal-article"] instead of "liferay_journal["journal-article"]. The card taglibs are new in Liferay 7, but you can use any bootstrap similar components instead. (http://getbootstrap.com/2.3.2/components.html).2) You should be able to obtain the AssetRenderer from within the WC template, and obtain the URLs with it. Reply Reply as... Cancel
Orin Fink Petr Bodnár 6 Years Ago For the link to detail, you _could_ put a token (like {{link-to-detail}} ) in the web content article template and then do a replace of that token with the link from the ADT code.The ADT (and the asset entry) give you a little more power to build the detail link so that worked better for us in our case while using a similar approach with velocity in 6.2. Reply Reply as... Cancel Petr Bodnár Orin Fink 6 Years Ago OK, sounds reasonable, thanks for your sharing Reply Reply as... Cancel
Petr Bodnár Orin Fink 6 Years Ago OK, sounds reasonable, thanks for your sharing Reply Reply as... Cancel
Eduardo P. Garcia Petr Bodnár 6 Years Ago Hi Petr,1) Certainly, the article contains code examples that are directly applicable only to Liferay 7. But you can achieve this on 6.2, too. In that version, the journal-article taglib was located in the liferay-ui namespace. Thus, you'd have to use liferay_ui["journal-article"] instead of "liferay_journal["journal-article"]. The card taglibs are new in Liferay 7, but you can use any bootstrap similar components instead. (http://getbootstrap.com/2.3.2/components.html).2) You should be able to obtain the AssetRenderer from within the WC template, and obtain the URLs with it. Reply Reply as... Cancel
Sandro Zacchino 6 Years Ago Hi, great article. I'm wondering if its possible to set some sort of context variable in the red boxed adt (the one for assetpublisher) and use it in the web content model (the green boxed one). Using an asset publisher it's common to build a viewUrl from asset like this:viewURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, assetRenderer, entry, true)However I don't know how to render this information in the web content model. There is some mechanism to pass information between these two ftls? Reply Reply as... Cancel Sandro Zacchino Sandro Zacchino 6 Years Ago I solved using the following steps:1) in the asset publisher's ADT I've used:<#assign serviceContext = staticUtil["com.liferay.portal.kernel.service.ServiceContextThreadLocal"].getServiceContext() /><#if entries?has_content> <#list entries as entry> <#assign assetRenderer = entry.getAssetRenderer() journalArticle = assetRenderer.getAssetObject() viewURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, assetRenderer, entry, !stringUtil.equals(assetLinkBehavior, "showFullContent")) temp = serviceContext.setAttribute("my_view_url", viewURL) /> <@liferay_journal["journal-article"] articleId=journalArticle.getArticleId() ddmTemplateKey="000000" groupId=journalArticle.getGroupId() /> </#list></#if>2) in web content template I've used:...<#assign serviceContext = staticUtil["com.liferay.portal.kernel.service.ServiceContextThreadLocal"].getServiceContext() viewURL = serviceContext.getAttribute("my_view_url") />${viewURL}...Do you think it's a good way to pass information between the two templates?Thanks Reply Reply as... Cancel Santiago Pérez de la Cámara Sandro Zacchino 6 Years Ago Hi Sandro:I'm trying to reproduce your example but I get an error in the structure template when accessing to the serviceContext's attribute:The following has evaluated to null or missing:==> serviceContext.getAttribute("my_view_url") [in template "20116#20152#43209" at line 6, column 22]There are no errors when processing the ADT, just in the structure template. What is it missing?Thank you! Reply Reply as... Cancel Sandro Zacchino Santiago Pérez de la Cámara 6 Years Ago Hi Santiago,the line you reported should be put in the model template, but you have to put a temp = serviceContext.setAttribute("my_view_url", "some value") in the assetpublisher template, processed before the model one, otherwise the attribute will not be found in the model template Reply Reply as... Cancel
Sandro Zacchino Sandro Zacchino 6 Years Ago I solved using the following steps:1) in the asset publisher's ADT I've used:<#assign serviceContext = staticUtil["com.liferay.portal.kernel.service.ServiceContextThreadLocal"].getServiceContext() /><#if entries?has_content> <#list entries as entry> <#assign assetRenderer = entry.getAssetRenderer() journalArticle = assetRenderer.getAssetObject() viewURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, assetRenderer, entry, !stringUtil.equals(assetLinkBehavior, "showFullContent")) temp = serviceContext.setAttribute("my_view_url", viewURL) /> <@liferay_journal["journal-article"] articleId=journalArticle.getArticleId() ddmTemplateKey="000000" groupId=journalArticle.getGroupId() /> </#list></#if>2) in web content template I've used:...<#assign serviceContext = staticUtil["com.liferay.portal.kernel.service.ServiceContextThreadLocal"].getServiceContext() viewURL = serviceContext.getAttribute("my_view_url") />${viewURL}...Do you think it's a good way to pass information between the two templates?Thanks Reply Reply as... Cancel Santiago Pérez de la Cámara Sandro Zacchino 6 Years Ago Hi Sandro:I'm trying to reproduce your example but I get an error in the structure template when accessing to the serviceContext's attribute:The following has evaluated to null or missing:==> serviceContext.getAttribute("my_view_url") [in template "20116#20152#43209" at line 6, column 22]There are no errors when processing the ADT, just in the structure template. What is it missing?Thank you! Reply Reply as... Cancel Sandro Zacchino Santiago Pérez de la Cámara 6 Years Ago Hi Santiago,the line you reported should be put in the model template, but you have to put a temp = serviceContext.setAttribute("my_view_url", "some value") in the assetpublisher template, processed before the model one, otherwise the attribute will not be found in the model template Reply Reply as... Cancel
Santiago Pérez de la Cámara Sandro Zacchino 6 Years Ago Hi Sandro:I'm trying to reproduce your example but I get an error in the structure template when accessing to the serviceContext's attribute:The following has evaluated to null or missing:==> serviceContext.getAttribute("my_view_url") [in template "20116#20152#43209" at line 6, column 22]There are no errors when processing the ADT, just in the structure template. What is it missing?Thank you! Reply Reply as... Cancel Sandro Zacchino Santiago Pérez de la Cámara 6 Years Ago Hi Santiago,the line you reported should be put in the model template, but you have to put a temp = serviceContext.setAttribute("my_view_url", "some value") in the assetpublisher template, processed before the model one, otherwise the attribute will not be found in the model template Reply Reply as... Cancel
Sandro Zacchino Santiago Pérez de la Cámara 6 Years Ago Hi Santiago,the line you reported should be put in the model template, but you have to put a temp = serviceContext.setAttribute("my_view_url", "some value") in the assetpublisher template, processed before the model one, otherwise the attribute will not be found in the model template Reply Reply as... Cancel
Heiko Ottenbacher 6 Years Ago Hello.. Thanks for this great article. But I have one question: What if I want to get the html code that tag creates itself? Is there a way to obtain the html code fragment of the asset rendered by its template and store it - for example in a variable?Thanks alot in advance! Reply Reply as... Cancel
Joseph Toman 6 Years Ago This is an interesting idea. The only thing I'm not thrilled about is that hardcoded DDMTemplateKey . If you are collaborating with someone, or need to move it from a dev system to production it's certainly going to change. I wonder, can a web content template tell what portlet it is being rendered in? If so then it would be better to code one template with<#if isAssetPublisher > ... <#else> <#-- is WCD --> ... </#if>sort of logic. Reply Reply as... Cancel