新闻列表

webcontent

结构

<root available-locales="zh_CN" default-locale="zh_CN">
	<dynamic-element dataType="string" indexType="keyword" name="content" readOnly="false" repeatable="false" required="false" showLabel="true" type="textarea" width="small">
		<meta-data locale="zh_CN">
			<entry name="label">
				<![CDATA[content]]>
			</entry>
			<entry name="predefinedValue">
				<![CDATA[]]>
			</entry>
			<entry name="tip">
				<![CDATA[]]>
			</entry>
		</meta-data>
	</dynamic-element>
	<dynamic-element dataType="document-library" fieldNamespace="ddm" indexType="keyword" name="img" readOnly="false" repeatable="false" required="false" showLabel="true" type="ddm-documentlibrary" width="">
		<meta-data locale="zh_CN">
			<entry name="label">
				<![CDATA[img]]>
			</entry>
			<entry name="predefinedValue">
				<![CDATA[]]>
			</entry>
			<entry name="tip">
				<![CDATA[]]>
			</entry>
		</meta-data>
	</dynamic-element>
</root>

结构模板  无所谓

webpublisher

模板

#set($url = $request.getAttribute("CURRENT_URL"))
#set ($URLCurrent = "/web" +$themeDisplay.getLayout().getGroup().getFriendlyURL())
$url=$url.sub
<div class="listBox clear">
    <div class="newsBox">
        <div class="title clear">
            <a href="#">$url</a>
            <h3>$URLCurrent</h3>
        </div>
        <ul>
            <li>
                <a href="#"><img src="img/img-3.jpg"/></a>
                <p>
                    <a class="top-2" href="">xxxx</a>
                <ul class="infoList">
                    
                    #if (!$entries.isEmpty())
	                #foreach ($curEntry in $entries)
	                 #set ($assetRenderer = $curEntry.getAssetRenderer() )
                    #set ($article = $assetRenderer.getArticle() )
                    #set ($articleId= $article.getArticleId() )
                    #set ($viewURL = $URLCurrent + "/fw?articleId=" + $articleId)
                    <li><a href="$viewURL">$curEntry.getTitle($locale)</a></li>
                    		
                    #end
                    #end
                </ul>
                </p>
            </li>
        </ul>
    </div>
</div>


新闻详情页

#set($url = $themeDisplay.getURLCurrent())
#set($articleId = $url.substring($url.indexOf("=")))
#set($articleId = $articleId.substring(1))

#if (!$entries.isEmpty())
    #foreach ($curEntry in $entries)
        #set($curEntryId = $curEntry.getAssetRenderer().getArticle().getArticleId())
        #if ($articleId == $curEntryId)
            <!--<h4> $curEntry.getTitle($locale)</h4>-->
            #set ($renderer = $curEntry.getAssetRenderer())
            #set ($article = $renderer.getArticle())
            #set( $document = $saxReaderUtil.read($article.getContentByLocale($locale.toString())))
            
           #set ($img = $document.selectSingleNode("/root/dynamic-element[@name='img']/dynamic-content"))
           //图片 $img.getText()
           <img class="detail-news-picture" src="$img.getText()"/>
           #set ($content = $document.selectSingleNode("/root/dynamic-element[@name='content']/dynamic-content"))
           //内容$content.getText()
           #set ($curtitle = $article.getTitle($locale))
           //标题$curtitle            
        #end
    #end
#end

内容获取

#set($url = $themeDisplay.getURLCurrent())
#set($articleId = $url.substring($url.indexOf("=")))
#set($articleId = $articleId.substring(1))

#if (!$entries.isEmpty())
    #foreach ($curEntry in $entries)
        #set($curEntryId = $curEntry.getAssetRenderer().getArticle().getArticleId())
        #if ($articleId == $curEntryId)
            <!--<h4> $curEntry.getTitle($locale)</h4>-->
            #set ($renderer = $curEntry.getAssetRenderer())
            #set ($article = $renderer.getArticle())
            #set( $document = $saxReaderUtil.read($article.getContentByLocale($locale.toString())))
            #set ($root = $document.getRootElement())
            #set ($contentC = $root.selectNodes("dynamic-element"))
            #set ($k = 0)
            #foreach ($c in $contentC)
                #if($k == 0)
                    #set ($content = $c.selectSingleNode("dynamic-content"))
                    #set ($img = ${content.text})
                #end
                #set($k = $k + 1)
            #end
            #set ($i = 0)
            #foreach ($c in $contentC)
                #if($i == 1)
                    #set ($content = $c.selectSingleNode("dynamic-content"))
                    #set ($finalContent = ${content.text})
                #end
                #set($i = $i + 1)
            #end
            <!--
            <img src='${img}' />
            $curEntry.getSummary($locale.toString())
            <div>
                $finalContent
            </div>
            -->
            <div class="detail-news-section">
                <div class="detail-news-title">
                    <span class="detail-news-title-text">$curEntry.getTitle($locale)</span>
                    <span class="detail-news-title-date">
                        <small>$curEntry.getCreateDate()</small>
                    </span>
                </div>
                <div class="detail-news-content">
                    <div class="detail-news-picture-div">
                        <img class="detail-news-picture" src="${img}"/>
                    </div>
                    <p>
                    $finalContent
                    </p>
                </div>
            </div>
        #end
    #end
#end

新闻列表与分类配合


#if (!$entries.isEmpty())
	#set ($list = [])
	#set ($listOne = [])
	#set ($listTwo = [])
	#set ($listThree = [])
	#set ($listFour = [])
	#foreach ($curEntry in $entries)
		##$curEntry.getTitle($locale)
		#set ($renderer = $curEntry.getAssetRenderer())
		#set ($article = $renderer.getArticle())
		<input type="hidden" value="$article.getArticleId()">
		#set ($document = $saxReaderUtil.read($article.getContentByLocale($locale.toString())))
    	#set ($no = $document.selectSingleNode("/root/dynamic-element[@name='No']/dynamic-content"))
		#set ($url = $document.selectSingleNode("/root/dynamic-element[@name='URL']/dynamic-content"))
		#set ($target = $document.selectSingleNode("/root/dynamic-element[@name='URL_Target']/dynamic-content"))
		#set( $category = $document.selectSingleNode("/root/dynamic-element[@name='Category']/dynamic-content"))
		#set( $title = $document.selectSingleNode("/root/dynamic-element[@name='Category_Value']/dynamic-content"))

		#set ($Integer = 0)
        #set ($curtitle = $article.getTitle($locale))
        #set ($curentitle = $article.getTitle('en_GB'))
        #set ($urlValue = $url.getText())
        #set ($targetValue = $target.getText())
        #set ($categoryValue = $category.getText())
        #set ($titleValue = $title.getText())
        #if( $categoryValue == "One")
        	#set( $listOneTitle = $titleValue)
        	#set ($tmp = $listOne.add({"no" : $Integer.parseInt($no.getText()), "title" :$curtitle , "url" : $urlValue , "target" :$targetValue,"entitle":$curentitle }))
        #elseif ($categoryValue == "Two")
        	#set( $listTwoTitle = $titleValue)
        	#set ($tmp = $listTwo.add({"no" : $Integer.parseInt($no.getText()), "title" :$curtitle , "url" : $urlValue , "target" :$targetValue,"entitle":$curentitle }))
        #elseif ($categoryValue == "Three")
        	#set( $listThreeTitle = $titleValue)
        	#set ($tmp = $listThree.add({"no" : $Integer.parseInt($no.getText()), "title" :$curtitle , "url" : $urlValue , "target" :$targetValue,"entitle":$curentitle }))
        #elseif ($categoryValue == "Four")
        	#set( $listFourTitle = $titleValue)
        	#set ($tmp = $listFour.add({"no" : $Integer.parseInt($no.getText()), "title" :$curtitle , "url" : $urlValue , "target" :$targetValue,"entitle":$curentitle }))
        #else 	
        #end
	#end

    <div class = "highlight-links-frame">
    	#set ($finalListOne = [])
    	#set ($finalListTwo = [])
    	#set ($finalListThree = [])
    	#set ($finalListFour = [])
		#set ($URLCurrent = "/web" +$themeDisplay.getLayout().getGroup().getFriendlyURL())
		#set ($k = 0)
    	#foreach ($fff in $sortTool.sort($listOne, 'no:asc'))
			#set ($aaa = $finalListOne.add($fff))
		#end
		#foreach ($fff in $sortTool.sort($listTwo, 'no:asc'))
			#set ($aaa = $finalListTwo.add($fff))
		#end
		#foreach ($fff in $sortTool.sort($listThree, 'no:asc'))
			#set ($aaa = $finalListThree.add($fff))
		#end
		#foreach ($fff in $sortTool.sort($listFour, 'no:asc'))
			#set ($aaa = $finalListFour.add($fff))
		#end

		<div class="portlet-column span3">
			<div class="bottomlinks-section">
				<div class="bottomlinks-title">$listOneTitle</div>
				#foreach ($obj in $finalListOne)
					<div class="bottomlinks-links">
						#if ($obj.url.contains("http"))
							<a href="$obj.url" target="$obj.target" id="assetmanager" tracename="$obj.entitle,homepage-box">
								$obj.title 
							</a>
						#elseif ($obj.url.length() == "0")
							<a target="$obj.target" id="assetmanager" tracename="$obj.entitle,homepage-box">
								$obj.title 
							</a>
						#else
							<a href="$URLCurrent$obj.url" target="$obj.target" id="assetmanager" tracename="$obj.entitle,homepage-box">
								$obj.title 
							</a>
						#end
					</div>
				#end
			</div>
        </div>
        <div class="portlet-column span3">
			<div class="bottomlinks-section">
				<div class="bottomlinks-title">$listTwoTitle</div>
				#foreach ($obj in $finalListTwo)
					<div class="bottomlinks-links">
						#if ($obj.url.contains("http"))
							<a href="$obj.url" target="$obj.target" id="assetmanager" tracename="$obj.entitle,homepage-box">
								$obj.title 
							</a>
						#elseif ($obj.url.length() == "0")
							<a target="$obj.target" id="assetmanager" tracename="$obj.entitle,homepage-box">
								$obj.title 
							</a>
						#else
							<a href="$URLCurrent$obj.url" target="$obj.target" id="assetmanager" tracename="$obj.entitle,homepage-box">
								$obj.title 
						#end
					</div>
				#end
			</div>
        </div>
        <div class="portlet-column span3">
			<div class="bottomlinks-section">
				<div class="bottomlinks-title">$listThreeTitle</div>
				#foreach ($obj in $finalListThree)
					<div class="bottomlinks-links">
						#if ($obj.url.contains("http"))
							<a href="$obj.url" target="$obj.target" id="assetmanager" tracename="$obj.entitle,homepage-box">
								$obj.title 
							</a>
						#elseif ($obj.url.length() == "0")
							<a target="$obj.target" id="assetmanager" tracename="$obj.entitle,homepage-box">
								$obj.title 
							</a>
						#else
							<a href="$URLCurrent$obj.url" target="$obj.target" id="assetmanager" tracename="$obj.entitle,homepage-box">
								$obj.title 
							</a>
						#end
					</div>
				#end
			</div>
        </div>
        <div class="portlet-column span3">
			<div class="bottomlinks-section">
				<div class="bottomlinks-title">$listFourTitle</div>
				#foreach ($obj in $finalListFour)
					<div class="bottomlinks-links">
						#if ($obj.url.contains("http"))
							<a href="$obj.url" target="$obj.target" id="assetmanager" tracename="$obj.entitle,homepage-box">
								$obj.title 
							</a>
						#elseif ($obj.url.length() == "0")
							<a target="$obj.target" id="assetmanager" tracename="$obj.entitle,homepage-box">
								$obj.title
							</a>
						#else
							<a href="$URLCurrent$obj.url" target="$obj.target" id="assetmanager" tracename="$obj.entitle,homepage-box">
								$obj.title 
							</a>
						#end
					</div>
				#end
			</div>
        </div>
        <div style="clear:both"></div>
    </div>


#end



阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/fwk19840301/article/details/79963760
个人分类: Liferay
想对作者说点什么? 我来说一句

ul li 新闻列表样式

无标题文档

nailwl nailwl

2009-10-22 10:33:00

阅读数:7209

没有更多推荐了,返回首页

不良信息举报

新闻列表

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭