![](/img/trans.png)
[英]LIFERAY 6.2 - Send a Web Content to another Portlet at another Page
[英]Link to page not working liferay 6.2 web content template
我在Liferay6.2中創建了一個網站模板,在該網站模板中,我創建了一個結構和模板,其中使用了指向頁面的鏈接。 頁面鏈接的代碼如下:
<a href="$Link_to_Page2163.getFriendlyUrl()">Create Project</a>
這是Web內容模板的完整代碼:
#if (!$scrom_image.getSiblings().isEmpty())
#foreach ($cur_scrom_image in $scrom_image.getSiblings())
<div id="scrommaindiv">
<center>
<div class="scrom_img"><img alt="scrom_image" src="$cur_scrom_image.getData()"/></div>
<h3>
<a href="$cur_scrom_image.Link_to_Page2163.getFriendlyUrl()">$cur_scrom_image.scrom_head.getData()</a>
</h3>
<div class="scrum_desc">$cur_scrom_image.scrom_desc.getData()</div>
</center>
</div>
#end
#end
當我使用網站模板創建組織時,這些鏈接不起作用,但仍在顯示網站模板ID的鏈接中。
示例:在檢查元素中,我發現了這樣的鏈接
<a href="http://vidyayugscrum.buildyourcareerpath.com:7080/group/template-39711/my-project" id="yui_patched_v3_11_0_1_1434085215630_420">Create Project</a>
在創建的組織中,更改鏈接后可以正常工作,但是我想要的是在創建組織時,在創建的組織中,鏈接應該可以正常工作。 例如 :
<a href="http://vidyayugscrum.buildyourcareerpath.com:7080/group/my-project" id="yui_patched_v3_11_0_1_1434085215630_420">Create Project</a>
如何使用速度代碼實現這一目標?
在您的力度模板中嘗試以下代碼:
#set ($layoutLocalService = $serviceLocator.findService("com.liferay.portal.service.LayoutLocalService"))
#set ($linkPage = $cur_scrom_image.Link_to_Page2163.getFriendlyUrl().split("@"))
#set ($pageLayout = $layoutLocalService.getLayout($getterUtil.getLong($linkPage.get(2)), false, $getterUtil.getLong($linkPage.get(0))))
#set ($pageURL = $pageLayout.getFriendlyURL())
#if (!$scrom_image.getSiblings().isEmpty())
#foreach ($cur_scrom_image in $scrom_image.getSiblings())
<div id="scrommaindiv">
<center>
<div class="scrom_img"><img alt="scrom_image" src="$cur_scrom_image.getData()"/></div>
<h3>
<a href="$pageURL">$cur_scrom_image.scrom_head.getData()</a>
</h3>
<div class="scrum_desc">$cur_scrom_image.scrom_desc.getData()</div>
</center>
</div>
#end
#end
希望對您有所幫助! ;)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.