指向页面不工作的链接liferay 6.2 web内容模板

指向页面不工作的链接liferay 6.2 web内容模板,liferay,liferay-6,velocity,liferay-theme,liferay-velocity,Liferay,Liferay 6,Velocity,Liferay Theme,Liferay Velocity,我在Liferay6.2中创建了一个网站模板,在该网站模板中,我创建了一个结构和模板,在其中我使用了指向页面的链接。链接到页面的代码如下所示: <a href="$Link_to_Page2163.getFriendlyUrl()">Create Project</a> 以下是web内容模板的完整代码: #if (!$scrom_image.getSiblings().isEmpty()) #foreach ($cur_scrom_image in $scr

我在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
#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
#if(!$scrom_image.getsibles().isEmpty())
#foreach($scrom\u image.getsibles()中的cur\u scrom\u image)
$cur\u scrom\u image.scrom\u desc.getData()
#结束
#结束
当我使用网站模板创建组织时,链接不起作用,仍然在链接中显示网站模板id

示例:在inspect元素中,我发现了如下链接

<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>


如何使用velocity代码实现这一点?

在velocity模板中尝试以下代码:

#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
#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
#set($layoutLocalService=$serviceLocator.findService(“com.liferay.portal.service.layoutLocalService”))
#set($linkPage=$cur\u scrom\u image.Link\u to\u Page2163.getFriendlyUrl().split(“@”))
#set($pageLayout=$layoutLocalService.getLayout($getterUtil.getLong($linkPage.get(2)),false,$getterUtil.getLong($linkPage.get(0)))
#设置($pageURL=$pageLayout.getFriendlyURL())
#if(!$scrom\u image.getsibles().isEmpty())
#foreach($scrom\u image.getsibles()中的cur\u scrom\u image)
$cur\u scrom\u image.scrom\u desc.getData()
#结束
#结束

我希望这有帮助!;)

变量
$Link_to_Page2163
在哪里定义?您是如何得到它的?@PrakashK这是我的模板代码我不明白您想要什么,您能一步一步地解释一下您做了什么(包括所有源代码)以及您想要什么吗?@MarcoMercuri您能加入这里吗