【问题标题】:How to find web contents with specific structure field value?如何查找具有特定结构字段值的网页内容?
【发布时间】:2011-12-10 23:54:44
【问题描述】:

我想知道是否有人可以给我一些想法/sn-ps 关于如何创建 Velocity 模板以遍历特定结构的 Web 内容项,并根据特定结构字段的值呈现内容?

【问题讨论】:

    标签: liferay-6 liferay-velocity


    【解决方案1】:

    这是来自navigation.vm 的sn-p,它将呈现组链接:

    #set($groupLocalService = $serviceLocator.findService("com.liferay.portal.service.GroupLocalService"))
    #set($groupCount = $groupLocalService.getGroupsCount())
    #set($groups = $groupLocalService.getGroups( 0, $groupCount))
    <div id="community-links">
        <ul>
            #foreach ($group in $groups)
                #if ($group.community && $group.name != 'Guest' && $group.hasPublicLayouts())
                    #set ($groupURL = $portletURLFactory.create($request, $group.name, $group.defaultPublicPlid, "ACTION_PHASE"))
                    ${groupURL.setWindowState("normal")}
                    ${groupURL.setPortletMode("view")}
                    ${groupURL.setLifecycle("0")}
                    ${groupURL.setParameter("groupId", ${group.getGroupId().toString()})}
                    ${groupURL.setParameter("privateLayout", "false")}
                    #if ($group.getGroupId() == $themeDisplay.getLayout().getGroup().getGroupId() )
                        #set ($className = "selected")
                    #else
                        #set ($className = "unselected")
                    #end
                    <li class="${className}">                         
                        <a href="${groupURL.toString()}"><span>$group.getName()</span></a>
                    </li> 
                #end
            #end    
        </ul>
    </div>
    

    【讨论】:

    猜你喜欢
    • 2018-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-19
    • 2015-07-21
    • 2021-09-21
    • 2012-06-05
    相关资源
    最近更新 更多