12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625 |
- <!DOCTYPE HTML>
- <html lang="" >
- <head>
- <title>发布器调用大全 · GitBook</title>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
- <meta name="description" content="">
- <meta name="generator" content="GitBook 3.2.0">
-
-
-
-
- <link rel="stylesheet" href="../gitbook/style.css">
-
-
-
- <link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism.css">
-
-
-
- <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
-
-
-
- <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
-
-
-
-
-
-
- <link rel="stylesheet" href="../styles/website.css">
-
-
-
-
-
- <meta name="HandheldFriendly" content="true"/>
- <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
- <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
- <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
-
-
- <link rel="prev" href="./" />
-
- </head>
- <body>
-
- <div class="book">
- <div class="book-summary">
-
-
- <div id="book-search-input" role="search">
- <input type="text" placeholder="Type to search" />
- </div>
-
- <nav role="navigation">
-
- <ul class="summary">
-
-
-
-
-
-
-
- <li class="chapter " data-level="1.1" data-path="../">
-
- <a href="../">
-
-
- Introduction
-
- </a>
-
-
- </li>
-
- <li class="chapter " data-level="1.2" data-path="../new/new.html">
-
- <a href="../new/new.html">
-
-
- 新人入职后需要做的工作
-
- </a>
-
-
- </li>
-
- <li class="chapter " data-level="1.3" data-path="../host/host.html">
-
- <a href="../host/host.html">
-
-
- 常用HOST
-
- </a>
-
-
- </li>
-
- <li class="chapter " data-level="1.4" data-path="../workflow/workflow.html">
-
- <a href="../workflow/workflow.html">
-
-
- 前端工作流配置
-
- </a>
-
-
- </li>
-
- <li class="chapter " data-level="1.5" >
-
- <span>
-
-
- 多玩SVN和常用页面
-
- </span>
-
-
- <ul class="articles">
-
-
- <li class="chapter " data-level="1.5.1" data-path="../svn/address.html">
-
- <a href="../svn/address.html">
-
-
- svn及常用地址
-
- </a>
-
-
- </li>
-
- <li class="chapter " data-level="1.5.2" data-path="../svn/">
-
- <a href="../svn/">
-
-
- svn目录介绍
-
- </a>
-
-
- </li>
-
- </ul>
-
- </li>
-
- <li class="chapter " data-level="1.6" data-path="./">
-
- <a href="./">
-
-
- 发布器简介
-
- </a>
-
-
- <ul class="articles">
-
-
- <li class="chapter active" data-level="1.6.1" data-path="all.html">
-
- <a href="all.html">
-
-
- 发布器调用大全
-
- </a>
-
-
- </li>
-
- <li class="chapter " data-level="1.6.2" >
-
- <span>
-
-
- 实用技巧
-
- </span>
-
-
- <ul class="articles">
-
-
- <li class="chapter " data-level="1.6.2.1" data-path="locate.html">
-
- <a href="locate.html">
-
-
- 定位相关
-
- </a>
-
-
- </li>
-
- <li class="chapter " data-level="1.6.2.2" data-path="quote.html">
-
- <a href="quote.html">
-
-
- 引用模板
-
- </a>
-
-
- </li>
-
- <li class="chapter " data-level="1.6.2.3" data-path="addredss.html">
-
- <a href="addredss.html">
-
-
- 预览地址和正式地址
-
- </a>
-
-
- </li>
-
- <li class="chapter " data-level="1.6.2.4" data-path="flesh.html">
-
- <a href="flesh.html">
-
-
- 刷新模板
-
- </a>
-
-
- </li>
-
- </ul>
-
- </li>
-
- <li class="chapter " data-level="1.6.3" >
-
- <span>
-
-
- 常用语法
-
- </span>
-
-
- <ul class="articles">
-
-
- <li class="chapter " data-level="1.6.3.1" data-path="alert.html">
-
- <a href="alert.html">
-
-
- 语法核心
-
- </a>
-
-
- </li>
-
- <li class="chapter " data-level="1.6.3.2" data-path="piclist.html">
-
- <a href="piclist.html">
-
-
- 图片列表
-
- </a>
-
-
- </li>
-
- <li class="chapter " data-level="1.6.3.3" data-path="rank.html">
-
- <a href="rank.html">
-
-
- 排行榜
-
- </a>
-
-
- </li>
-
- <li class="chapter " data-level="1.6.3.4" data-path="dwvideo.html">
-
- <a href="dwvideo.html">
-
-
- 多玩视频
-
- </a>
-
-
- </li>
-
- <li class="chapter " data-level="1.6.3.5" data-path="huyavideo.html">
-
- <a href="huyavideo.html">
-
-
- 虎牙视频
-
- </a>
-
-
- </li>
-
- </ul>
-
- </li>
-
- <li class="chapter " data-level="1.6.4" data-path="special.html">
-
- <a href="special.html">
-
-
- 专区嵌套
-
- </a>
-
-
- <ul class="articles">
-
-
- <li class="chapter " data-level="1.6.4.1" data-path="./">
-
- <a href="./">
-
-
- 首页
-
- </a>
-
-
- </li>
-
- <li class="chapter " data-level="1.6.4.2" data-path="tag.html">
-
- <a href="tag.html">
-
-
- 标签和标签图
-
- </a>
-
-
- </li>
-
- <li class="chapter " data-level="1.6.4.3" data-path="art.html">
-
- <a href="art.html">
-
-
- 文章页
-
- </a>
-
-
- </li>
-
- </ul>
-
- </li>
-
- </ul>
-
- </li>
-
- <li class="chapter " data-level="1.7" data-path="../duowan/">
-
- <a href="../duowan/">
-
-
- 多玩网
-
- </a>
-
-
- </li>
-
- <li class="chapter " data-level="1.8" data-path="../box/">
-
- <a href="../box/">
-
-
- 盒子
-
- </a>
-
-
- <ul class="articles">
-
-
- <li class="chapter " data-level="1.8.1" data-path="../box/lolbox.html">
-
- <a href="../box/lolbox.html">
-
-
- LOL盒子
-
- </a>
-
-
- </li>
-
- </ul>
-
- </li>
-
- <li class="chapter " data-level="1.9" data-path="../book/README.html">
-
- <span>
-
-
- 文档制作简介
-
- </a>
-
-
- </li>
-
-
- <li class="divider"></li>
- <li>
- <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
- Published with GitBook
- </a>
- </li>
- </ul>
- </nav>
-
-
- </div>
- <div class="book-body">
-
- <div class="body-inner">
-
-
- <div class="book-header" role="navigation">
-
- <!-- Title -->
- <h1>
- <i class="fa fa-circle-o-notch fa-spin"></i>
- <a href=".." >发布器调用大全</a>
- </h1>
- </div>
- <div class="page-wrapper" tabindex="-1" role="main">
- <div class="page-inner">
-
- <div id="book-search-results">
- <div class="search-noresults">
-
- <section class="normal markdown-section">
-
- <h1 id="发布器语法调用大全">发布器语法调用大全</h1><h2 id="发布器的基本调用">发布器的基本调用</h2><h3 id="使用方法">使用方法</h3><blockquote><p>这里必须要看!!!!!!! 这里必须要看!!!!!!! 这里必须要看!!!!!!! 重要的事情说3遍!!!!!!</p></blockquote><p>调用分下面几部走
- 1. 首先需要确定的是需要调用数据的模板是属于什么类型,栏目,最终文章还是其他
- 点击进入模板,在分类的时候可以看到
- <img alt="文章页调用" src="img/base/shuoming1.jpg" title="说明"></p><ol><li><p>然后确定自己要调用的什么数据,具体的调用参数在<a title="发布器调用代码参数列表" href="#发布器调用代码参数列表">发布器调用代码参数列表</a></p></li>
- <li><p>然后这里就要分成两种情况,一种是最终文章页,一种是非最终文章页</p><ul><li><p><code>最终文章页</code>
- 在最终文章页里面,调用文章本身内容的时候就可以直接复制参数描述为<code>最终文章</code>的即可,如我想用文章作者,那样直接写$author就可以了,其他的数据也是类似的</p></li>
- <li><p><code>非最终文章页</code>
- 在最终文章页调用其他tag也算是这一类,使用方法如下
- 1. 确定调用的tag,如<code>重点</code>等
- 1. 确定调用的数据,如图知道需要调用的数据有图片地址,文章链接,文章标题
- <img alt="文章页调用" src="img/base/shuoming2.jpg" title="说明2"></p><ol><li><p>找到这个内容的结构,<code>一般由前端提供</code></p><pre><code class="lang-html"> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-vedioList__link<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://art.yypm.com/140x78<span class="token punctuation">"</span></span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>em</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-vedioList__tit<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>海外TOP榜:LOL双榜第一暗双榜第一暗双榜第一暗黑3上涨<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>em</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span></code></pre>
- <p>如上为一个完整的内结构,转换成文字描述就是</p><pre><code class="lang-html"> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>文章链接<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-vedioList__link<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>图片地址<span class="token punctuation">"</span></span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>文章标题<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>em</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-vedioList__tit<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>文章标题<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>em</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span></code></pre>
- <ol><li>进入发布器语法调用
- </li></ol>
- <pre><code>#set ($list=$data.getPicList("杂谈",60,255,0,10)) //调用tag,以及确定好数量,具体语法会在下面有说明
- #foreach($one in $list) //获取每一条tag数据
- 这里写你喜欢调用的东西 例如:
- #set ($title=$one.getString("title")) //标题
- #set ($picurl=$one.getString("picurl")) //图片路径
- #set ($thislink=$data.getRelatedUrl($one.getString("articleid"))) //文章相对路径
- ....
- //填充到结构里面,就是对含有文字描述的结构进行填充
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-vedioList__link<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$picurl<span class="token punctuation">"</span></span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>em</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-vedioList__tit<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$title<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>em</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #end //结束循环</code></pre>
- <p><code>完整代码</code></p><pre><code> #set ($list=$data.getPicList("杂谈",60,255,0,10))
- #foreach($one in $list)
- #set ($title=$one.getString("title"))
- #set ($picurl=$one.getString("picurl"))
- #set ($thislink=$data.getRelatedUrl($one.getString("articleid")))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-vedioList__link<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$picurl<span class="token punctuation">"</span></span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>em</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-vedioList__tit<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$title<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>em</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #end</code></pre>
- </li></ol>
- </li></ul>
- </li></ol>
- <p>以上就是调用的一个简单介绍了,如果有什么不理解的话就联系我,我去补充完整</p><h3 id="发布器调用代码参数列表">发布器调用代码参数列表</h3><p><code>参数列表</code></p><table>
- <thead>
- <tr><th>最终文章页</th>
- <th>非最终文章页</th>
- <th>描述</th>
- </tr></thead><tbody>
- <tr><td>$articleid</td>
- <td>#set ($articleid=$one.getString("articleid"))</td>
- <td>文章id</td>
- </tr><tr><td>$title</td>
- <td>#set ($title=$one.getString("title"))</td>
- <td>文章标题</td>
- </tr><tr><td>$subtitle</td>
- <td>#set ($subtitle=$one.getString("subtitle"))</td>
- <td>文章副标题</td>
- </tr><tr><td>$titlecolor</td>
- <td>#set ($titlecolor=$one.getString("titlecolor"))</td>
- <td>文章标题颜色</td>
- </tr><tr><td>$digest</td>
- <td>#set ($digest=$one.getString("digest"))</td>
- <td>摘要</td>
- </tr><tr><td>$picurl</td>
- <td>#set ($picurl=$one.getString("picurl"))</td>
- <td>文章图片</td>
- </tr><tr><td>$source</td>
- <td>#set ($source=$one.getString("source"))</td>
- <td>文章来源</td>
- </tr><tr><td>$author</td>
- <td>#set ($author=$one.getString("author"))</td>
- <td>文章作者</td>
- </tr><tr><td>$posttime</td>
- <td>#set ($date=$tools.parseTime($one.getString("posttime"),"M.D"))</td>
- <td>发表时间</td>
- </tr><tr><td>$tags</td>
- <td>#set ($tags =$one.getString('alltag'))</td>
- <td>标签集</td>
- </tr><tr><td>$diy1</td>
- <td>#set ($diy1=$one.getString("diy1"))</td>
- <td>自定义diy1-5,更改数字即可</td>
- </tr><tr><td>$tags</td>
- <td>#set ($tags =$one.getString('alltag'))</td>
- <td>标签集,只有在getList语法下才可以取到</td>
- </tr><tr><td>$tags</td>
- <td>#set ($tags =$one.getString('alltag'))</td>
- <td>标签集,只有在getList语法下才可以取到</td>
- </tr><tr><td>$content</td>
- <td>-</td>
- <td>文章内容</td>
- </tr><tr><td>$power</td>
- <td>-</td>
- <td>权重</td>
- </tr><tr><td>$PageCount</td>
- <td>-</td>
- <td>分页总数</td>
- </tr><tr><td>$channelname</td>
- <td>-</td>
- <td>频道中文名</td>
- </tr><tr><td>$comment</td>
- <td>-</td>
- <td>评论</td>
- </tr><tr><td>$realtags</td>
- <td>-</td>
- <td>文章相关tag链接</td>
- </tr><tr><td>-</td>
- <td>#set ($thislink=$data.getRelatedUrl($articleid))</td>
- <td>`文章相对地址`,需要调用文章id作为参数</td>
- </tr><tr><td>-</td>
- <td>#set ($reallink=$data.getUrl($channelid,$articleid))</td>
- <td>`文章的绝对地址`,跨专区必用 ,需要调用文章id作为参数</td>
- </tr><tr><td>-</td>
- <td>#set ($vnum=$data.getVNum($articleid,$channelid,$title,$reallink))</td>
- <td>`文章浏览数`,需要调用文章id、频道id、标题、绝对地址作为参数</td>
- </tr><tr><td>-</td>
- <td>#set ($vtime=$data.getArticleVideoInfo($channelid, $articleid).shichang)</td>
- <td>`游戏时长`,需要调用文章id、频道id作为参数</td>
- </tr><tr><td>-</td>
- <td>#set ($repnum=$data.getVNumByAId($channelid,$articleid).getString("replys"))</td>
- <td>`回复评论数` ,需要调用文章id、频道id、标题、绝对地址作为参数</td>
- </tr></tbody></table>
- <p><code>使用方法</code></p><p><del>想怎么写怎么写</del> 按照上面的标准来写</p><p><code>最终文章页</code></p><p><img alt="文章页调用" src="img/base/article.jpg" title="文章页调用">
- 这里就会分别调用得到<code>发布时间</code>,<code>作者</code>,<code>tag</code>分类列表跟摘要了</p><p><code>非最终文章页</code></p><p><img alt="如何获取循环值" src="img/base/n-a.jpg" title="如何获取循环值">
- 这里就会调用<code>重点</code>这个tags所对应的一个列表,并且取这个列表里面每一篇的相对链接,标题以及发布时间</p><h2 id="图片列表">图片列表</h2><h3 id="图片列表调用代码">图片列表调用代码</h3><p><code>调用语法参数说明</code></p><table>
- <thead>
- <tr><th>名字</th>
- <th>描述</th>
- </tr></thead><tbody>
- <tr><td>tag</td>
- <td>tag标签</td>
- </tr><tr><td>powerfrom</td>
- <td>权重开始</td>
- </tr><tr><td>powerto</td>
- <td>权重结束</td>
- </tr><tr><td>start</td>
- <td>开始位置</td>
- </tr><tr><td>len</td>
- <td>调用长度</td>
- </tr><tr><td>频道id/频道中文名</td>
- <td>专区名字</td>
- </tr></tbody></table>
- <p><code>语法列表</code></p><p>不跨专区</p><pre><code>$data.getPicList(tag,powerfrom,powerto,start,len)或
- $data.getPicList(tag,powerfrom,powerto,len)或
- $data.getPicList(tag,start,len)或
- $data.getPicList(tag,len)</code></pre>
- <p>跨专区</p><pre><code>$data.getPicListOther(频道id/频道中文名,tag,powerfrom,powerto,start,len)或
- $data.getPicListOther(频道id/频道中文名,tag,powerfrom,powerto,len)或
- $data.getPicListOther(频道id/频道中文名,tag,start,len)或
- $data.getPicListOther(频道id/频道中文名,tag,len)</code></pre>
- <p><code>ex</code></p><pre><code>$data.getPicList(“最新视频”,60,255,0,10)
- $data.getPicListOther("英雄联盟",“最新视频”,60,255,0,10)</code></pre>
- <h3 id="轮播图">轮播图</h3><h4 id="轮播图小细节">轮播图小细节</h4><p>一般做轮播图的时候,都需要隐藏其他图片,显示第一张,特别是在导航的时候,需要显示第1个为激活状态,这样就需要在循环建立导航的时候写个判断,如果是第1张就激活</p><h4 id="普通的轮播图">普通的轮播图</h4><p><code>实际效果</code></p><p><img alt="普通的轮播图" src="img/cms/slide/slide-trigger.jpg" title="普通的轮播图"></p><p><code>代码说明</code></p><p>需要获取的内容有标题,链接,图片地址</p><p><code>完整代码</code></p><pre><code class="lang-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-slide-content<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>J_content<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- #set ($list=$data.getPicList("头图",60,255,3))
- #foreach($one in $list)
- #set ($thislink=$data.getRelatedUrl($one.getString("articleid")))
- #set ($title=$one.getString("title"))
- #set ($picurl=$one.getString("picurl"))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$picurl<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-slide-trigger J_nav<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- #set( $i = 1 )
- #set ($list=$data.getPicList("头图",60,255,3))
- #foreach($one in $list)
- #if($i==1)
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>selected<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #else
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #end
- #set( $i = $i + 1 )
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span></code></pre>
- <h4 id="带数字的轮播图">带数字的轮播图</h4><p><code>实际效果</code></p><p><img alt="带数字轮播图" src="img/cms/slide/slide-num.jpg" title="带数字轮播图"></p><p><code>代码说明</code></p><p>需要获取的内容有标题,链接,图片地址</p><p><code>完整代码</code></p><pre><code class="lang-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-slide-content<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>J_content<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- #set ($list=$data.getPicList("头图",60,255,3))
- #foreach($one in $list)
- #set ($thislink=$data.getRelatedUrl($one.getString("articleid")))
- #set ($title=$one.getString("title"))
- #set ($picurl=$one.getString("picurl"))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$picurl<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-slide-trigger J_nav<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- #set( $i = 1 )
- #set ($list=$data.getPicList("头图",60,255,3))
- #foreach($one in $list)
- #if($i==1)
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>selected<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$i<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #else
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$i<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #end
- #set( $i = $i + 1 )
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span></code></pre>
- <h4 id="文字分开的轮播图">文字分开的轮播图</h4><p><code>实际效果</code></p><p><img alt="带数字轮播图" src="img/cms/slide/slide-des.jpg" title="文字分开的轮播图"></p><p><code>代码说明</code></p><p>需要获取内容有标题,链接,图片地址</p><p><code>完整代码</code></p><pre><code class="lang-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-slide-content<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>J_content<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- #set ($list=$data.getPicList("头图",60,255,3))
- #foreach($one in $list)
- #set ($thislink=$data.getRelatedUrl($one.getString("articleid")))
- #set ($title=$one.getString("title"))
- #set ($picurl=$one.getString("picurl"))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$picurl<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-slide-trigger J_nav<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- #set( $i = 1 )
- #set ($list=$data.getPicList("头图",60,255,3))
- #foreach($one in $list)
- #set ($title=$one.getString("title"))
- #set ($thislink=$data.getRelatedUrl($one.getString("articleid")))
- #if($i==1)
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>selected<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$title<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #else
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$title<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #end
- #set( $i = $i + 1 )
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span></code></pre>
- <h4 id="描述不分开的轮播图">描述不分开的轮播图</h4><p><code>实际效果</code></p><p><img alt="带数字轮播图" src="img/cms/slide/slide-des2.jpg" title="描述不分开的轮播图"></p><p><code>代码说明</code></p><p>需要获取的内容有标题,链接,图片地址</p><p><code>完整代码</code></p><pre><code class="lang-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-slide-content<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>J_content<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- #set ($list=$data.getPicList("头图",60,255,3))
- #foreach($one in $list)
- #set ($thislink=$data.getRelatedUrl($one.getString("articleid")))
- #set ($title=$one.getString("title"))
- #set ($subtitle=$one.getString("subtitle"))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$one.getString(<span class="token punctuation">"</span></span><span class="token attr-name">picurl</span>")"<span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-slid__shadow<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>em</span><span class="token punctuation">></span></span>$title<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>em</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>em</span><span class="token punctuation">></span></span>$subtitle<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>em</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-slide-trigger J_nav<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- #set( $i = 1 )
- #set ($list=$data.getPicList("头图",60,255,3))
- #foreach($one in $list)
- #set ($title=$one.getString("title"))
- #if($i==1)
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>selected<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #else
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #end
- #set( $i = $i + 1 )
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span></code></pre>
- <h3 id="图文列表">图文列表</h3><h4 id="基本图片列表">基本图片列表</h4><p><code>实际效果</code></p><p><img alt="带数字轮播图" src="img/cms/pictext/pic1.jpg" title="基本图片列表"></p><p><code>代码说明</code></p><p>需要获取的内容有标题,链接,图片地址</p><p><code>完整代码</code></p><pre><code><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-picList<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- #set ($list=$data.getPicList("新游首曝",60,255,9))
- #foreach($one in $list)
- #set ($thislink=$data.getRelatedUrl($one.getString("articleid")))
- #set ($title=$one.getString("title"))
- #set ($picurl=$one.getString("picurl"))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>indexRecom__list<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-picList__link<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$picurl<span class="token punctuation">"</span></span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-picList__tit<span class="token punctuation">"</span></span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$title<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span></code></pre>
- <h4 id="带摘要的图文列表">带摘要的图文列表</h4><p><code>实际效果</code></p><p><img alt="带数字轮播图" src="img/cms/pictext/pic2.jpg" title="带摘要的图文列表"></p><p><code>代码说明</code></p><p>需要获取的内容有标题,链接,图片地址,摘要
- 需要注意的是,这里对摘要的长度是有限制的,所以用了发布器的截字功能来实现详细见<a title="发布器截字" href="#发布器截字">发布器截字</a></p><p><code>完整代码</code></p><pre><code><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- #set ($list=$data.getPicList("试玩解说",60,255,4))
- #foreach($one in $list)
- #set ($thislink=$data.getRelatedUrl($one.getString("articleid")))
- #set ($title=$one.getString("title"))
- #set ($picurl=$one.getString("picurl"))
- #set ($digest=$one.getString('digest'))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>gamePlay__list <span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>h3</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>gamePlay__listTit<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$title<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>h3</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-picList ext-cover<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-picList__link<span class="token punctuation">"</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$picurl<span class="token punctuation">"</span></span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-picList__shadowTit<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$title<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>icon-playSml<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>i</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>mod-picList__wShadow<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>gameDes<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$tools.substring($digest,0,44)...<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>btn-wg<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>围观<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span></code></pre>
- <h3 id="跨专区调用图片">跨专区调用图片</h3><p>只需要把getPicList换成getPicListOther,加上所跨专区的名字即可,其他是一样的,如
- <code>$data.getPicListOther("首页","试玩",60,255,4))</code></p><h3 id="调用多个tag的图片">调用多个tag的图片</h3><p>在最终文章页的话可以直接写$tags,非最终文章页tag之间用“,”隔开即可</p><p>本专区ex:</p><pre><code>$data.getPicList("试玩,解说,图集,视频",60,255,4))
- $data.getPicList($tags,60,255,4))</code></pre>
- <p>跨专区ex:</p><pre><code>$data.getPicListOther("首页","试玩,解说,图集,视频",60,255,4))
- $data.getPicListOther("首页",$tags,60,255,4))</code></pre>
- <h3 id="跨专区调用神坑">跨专区调用神坑</h3><p>!!!!!!!!!!!!!!!!!!!跨专区获取链接地址的时候切记不能调用相对地址,必须要用绝对地址!!!!!
- !!!!无论是调用单tag还是多tag都一样!!!!
- <del>不要问我为什么知道,说多了都是泪 ~_</del>~</p><p><code>错误示范</code></p><pre><code>#set ($list=$data.getPicListOther("首页","试玩解说",60,255,4))
- #foreach($one in $list)
- #set ($thislink=$data.getRelatedUrl($one.getString("articleid")))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span></code></pre>
- <p>这里出来会是一个错误的地址,错误的地址,错误的地址!因为getRelatedUrl 获取的是一个相对地址,是相对于本专区而言的,但是你调用的是跨专区的内容,链接应该是跨专区的链接而不应该是本专区的链接</p><p><code>正确示范</code></p><pre><code>#set ($list=$data.getPicListOther("首页","试玩解说",60,255,4))
- #set ($channel='首页')
- #foreach($one in $list)
- ##set ($reallink=$data.getUrl($channel,$one.getString("articleid")))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$reallink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span></code></pre>
- <h2 id="视频列表">视频列表</h2><h3 id="视频列表调用代码">视频列表调用代码</h3><p><code>调用语法说明</code></p><p>调用视频列表跟调用图片列表是一样的,不同的是视频列表一般前端都会为视频列表加一个播放的小图标
- 但是调用视频列表也有他一些新增的方法</p><p><code>语法列表</code>
- 以下所有的方法都是调用虎牙视频的数据了,原有的调用方法因为现在很少使用,干掉了</p><h3 id="普通视频列表">普通视频列表</h3><p><code>代码说明</code></p><p>需要获取的内容有标题,链接,图片地址,不需要显示时长的</p><p><code>实际效果</code></p><p><img alt="普通视频列表" src="img/cms/video/v-normal.jpg" title="普通视频列表"></p><p><code>实际代码</code></p><pre><code>#set ($list=$data.getPicList("游戏视频",60,255,10))
- #foreach($one in $list)
- #set ($thislink=$data.getRelatedUrl($one.getString("articleid")))
- #set ($title=$one.getString("title"))
- #set ($picurl=$one.getString("picurl"))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$picurl<span class="token punctuation">"</span></span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>em</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>i</span><span class="token punctuation">></span></span>$title<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>em</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span></code></pre>
- <h3 id="带时长普通视频列表">带时长普通视频列表</h3><p><code>这个属于旧代码</code></p><p><code>代码说明</code></p><p>需要获取的内容有标题,链接,图片地址,时长</p><p><code>实际效果</code></p><p><img alt="带时长视频列表" src="img/cms/video/v-time.jpg" title="带时长视频列表"></p><p><code>实际代码</code></p><p>普通视频</p><pre><code>#set ($list=$data.getPicList("游戏视频",60,255,10))
- #foreach($one in $list)
- #set ($thislink=$data.getRelatedUrl($one.getString("articleid")))
- #set ($title=$one.getString("title"))
- #set ($vtime=$data.getArticleVideoInfo($channelid, $one.getString("articleid")).shichang)
- #set ($picurl=$one.getString("picurl"))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$picurl<span class="token punctuation">"</span></span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>video-time<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>i</span><span class="token punctuation">></span></span>$vtime<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>em</span><span class="token punctuation">></span></span>$title<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>em</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span></code></pre>
- <h3 id="带时长虎牙视频列表">带时长虎牙视频列表</h3><p><code>代码说明</code></p><p>需要获取的内容有标题,链接,图片地址,时长,播放数,</p><p>获取虎牙视频列表时,需要获取视频的时长时,才会用到下面的代码</p><p>首先务必加入这3行</p><pre><code>#set ($myChannelId="频道id/频道中文名")
- #set ($getInfoByArticleId ="http://v.huya.com/?r=cmsapi/getInfoByArticleId")
- #set ($getInfoByArticleIdUrl = "${getInfoByArticleId}&channel=${myChannelId}&articleId=")</code></pre>
- <p><code>原理</code></p><p>这3行的原理是利用了发布器调用json的地址,具体的话可以看这里 <a title="获取Json数据" href="#获取Json数据">发布器获取json</a></p><p>参数说明</p><table>
- <thead>
- <tr><th>参数</th>
- <th>发布器语法</th>
- <th>说明</th>
- </tr></thead><tbody>
- <tr><td></td>
- <td>#set ($json = $data.getJsonData("${getInfoByArticleIdUrl}$one.getString('articleid')"))</td>
- <td>必写,用下面的参数的时候必须写这一行 详细的可以看[虎牙视频](#带播放数列表 "带播放数列表")</td>
- </tr><tr><td>视频标题</td>
- <td>#set ($vtitle=$json.get('video_title'))</td>
- <td></td>
- </tr><tr><td>视频副标题</td>
- <td>#set ($vsubtitle=$json.get('video_subtitle'))</td>
- <td></td>
- </tr><tr><td>播放总数</td>
- <td>#set ($vsum=$json.get('video_play_num'))</td>
- <td></td>
- </tr><tr><td>播放时长</td>
- <td>(#set ($vdur=$json.get('video_duration'))</td>
- <td></td>
- </tr><tr><td>播放评论数</td>
- <td>#set ($vcomment=$json.get('video_comment_num'))</td>
- <td></td>
- </tr><tr><td>视频封面</td>
- <td>#set ($vpic=$json.get('video_cover'))</td>
- <td></td>
- </tr><tr><td>用户昵称</td>
- <td>#set ($author=$json.get('nickname'))</td>
- <td></td>
- </tr></tbody></table>
- <p><code>特别说明</code></p><p>视频封面
- 所以这里调用的时候要想清楚是用哪一个参数,文章图片<code>是编辑上传的(用传图的方法getString("picurl")即可获得),</code>视频封面`是虎牙视频后台生成的,两者是不一样的。</p><p><code>实际效果</code></p><p><img alt="带时长视频列表" src="img/cms/video/v-num.jpg" title="带时长视频列表"></p><p><code>实际代码</code></p><pre><code>#set ($myChannelId="lol")
- #set ($getInfoByArticleId ="http://v.huya.com/?r=cmsapi/getInfoByArticleId")
- #set ($getInfoByArticleIdUrl = "${getInfoByArticleId}&channel=${myChannelId}&articleId=")
- #set ($list=$data.getPicList("游戏视频",60,255,10))
- #foreach($one in $list)
- #set ($json = $data.getJsonData("${getInfoByArticleIdUrl}$one.getString('articleid')"))
- #set ($date=$tools.parseTime($one.getString("posttime"),"M.D"))
- #set ($vsum=$json.get('video_play_num'))
- #set ($vlen=$json.get('video_duration'))
- #set ($thislink=$data.getRelatedUrl($one.getString("articleid")))
- #set ($title=$one.getString("title"))
- #set ($picurl=$one.getString("picurl"))
- #set ($date=$tools.parseTime($one.getString("posttime"),"M.D"))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>imgbox<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$picurl<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>ib-panel ib-panel-video<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$vlen<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>infobox<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>infobox-info<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$title<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>infobox-rec<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>em</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>infobox-rec-num<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$vsum<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>em</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>em</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>infobox-rec-time<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$date<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>em</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span></code></pre>
- <h2 id="文章列表">文章列表</h2><h3 id="文章列表调用代码">文章列表调用代码</h3><p><code>调用语法参数说明</code></p><table>
- <thead>
- <tr><th>名字</th>
- <th>描述</th>
- </tr></thead><tbody>
- <tr><td>tag</td>
- <td>tag标签</td>
- </tr><tr><td>powerfrom</td>
- <td>权重开始</td>
- </tr><tr><td>powerto</td>
- <td>权重结束</td>
- </tr><tr><td>start</td>
- <td>开始位置</td>
- </tr><tr><td>len</td>
- <td>调用长度</td>
- </tr><tr><td>频道id/频道中文名</td>
- <td>专区名字</td>
- </tr></tbody></table>
- <p><code>语法列表</code></p><p>不跨专区</p><pre><code>$data.getList(tag,powerfrom,powerto,start,len)或
- $data.getList(tag,powerfrom,powerto,len)或
- $data.getList(tag,start,len)或
- $data.getList(tag,len)</code></pre>
- <p>跨专区</p><pre><code>$data.getListOther(频道id/频道中文名,tag,powerfrom,powerto,start,len)或
- $data.getListOther(频道id/频道中文名,tag,powerfrom,powerto,len)或
- $data.getListOther(频道id/频道中文名,tag,start,len)或
- $data.getListOther(频道id/频道中文名,tag,len)</code></pre>
- <p><code>ex</code></p><pre><code>$data.getList(“最新视频”,60,255,0,10)
- $data.getListOther("英雄联盟",“最新视频”,60,255,0,10)</code></pre>
- <h3 id="新闻列表">新闻列表</h3><h3 id="普通新闻列表">普通新闻列表</h3><p><code>实际效果</code></p><p><img alt="普通新闻列表" src="img/cms/news/normal-news.jpg" title="普通新闻列表"></p><p><code>代码说明</code></p><p>需要获取的内容有标题,链接</p><p><code>完整代码</code></p><pre><code><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- #set ($list=$data.getList("重点",60,255,4))
- #foreach($one in $list)
- #set ($thislink=$data.getRelatedUrl($one.getString("articleid")))
- #set ($title=$one.getString("title"))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- $title
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span></code></pre>
- <h3 id="带日期新闻列表">带日期新闻列表</h3><p><code>实际效果</code></p><p><img alt="带日期新闻列表" src="img/cms/news/date-news.jpg" title="带日期新闻列表"></p><p><code>代码说明</code></p><p>需要获取的内容有标题,链接,发布日期</p><p><code>完整代码</code></p><pre><code><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- #set ($list=$data.getList("重点",60,255,4))
- #foreach($one in $list)
- #set ($thislink=$data.getRelatedUrl($one.getString("articleid")))
- #set ($title=$one.getString("title"))
- #set ($date=$tools.parseTime($one.getString("posttime"),"M.D"))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- $title
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>date<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$date<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span></code></pre>
- <h3 id="变色的新闻列表">变色的新闻列表</h3><p>变色的值源自于“标题颜色”,也可以其他,如副标题等等,这里拿“标题颜色”来举例子</p><p><code>实际效果</code></p><p><img alt="变色的新闻列表" src="img/cms/news/color-news.jpg" title="变色的新闻列表"></p><p><code>代码说明</code></p><p>需要获取的内容有标题,链接,日期,标题颜色</p><p><code>完整代码</code></p><pre><code><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- #set ($list=$data.getList("重点",60,255,4))
- #foreach($one in $list)
- #set ($thislink=$data.getRelatedUrl($one.getString("articleid")))
- #set ($title=$one.getString("title"))
- #set ($date=$tools.parseTime($one.getString("posttime"),"M.D"))
- #set ($color=$one.getString("titlecolor"))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- #if ($color=="")
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- #else
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span> <span class="token attr-name">style</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>color:$color<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- #end
- $title
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>date<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$date<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span></code></pre>
- <h3 id="带序号新闻列表">带序号新闻列表</h3><p>这里因为前3个是不一样的,所以前3个需要做一个单独处理</p><p><code>实际效果</code></p><p><img alt="带序号新闻列表" src="img/cms/news/num-news.jpg" title="带序号新闻列表"></p><p><code>代码说明</code></p><p>需要获取的内容有标题,链接,日期</p><p><code>完整代码</code></p><pre><code><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- #set ($i=1)
- #set ($list=$data.getList("重点",60,255,10))
- #foreach($one in $list)
- #set ($thislink=$data.getRelatedUrl($one.getString("articleid")))
- #set ($title=$one.getString("title"))
- #set ($date=$tools.parseTime($one.getString("posttime"),"M.D"))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- #if ($i < 4)
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>num<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$i<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span>
- #else
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span>$i<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span>
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- $title
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>date<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$date<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span></code></pre>
- <h3 id="带序号新闻列表升级版">带序号新闻列表升级版</h3><p>因为前3每个都是不一样的,所以每个都需要做一个单独的处理</p><p><code>实际效果</code></p><p><img alt="带序号新闻列表升级版" src="img/cms/news/huangguan-news.jpg" title="带序号新闻列表升级版"></p><p><code>代码说明</code></p><p>需要获取的内容有标题,链接,日期,作者</p><p><code>完整代码</code></p><pre><code><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- #set ($i=1)
- #set ($list=$data.getList("重点",60,255,10))
- #foreach($one in $list)
- #set ($thislink=$data.getRelatedUrl($one.getString("articleid")))
- #set ($title=$one.getString("title"))
- #set ($date=$tools.parseTime($one.getString("posttime"),"M.D"))
- #set ($author=$attr.getString("author"))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- #if ($i ==1 )
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>num first<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$i<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span>
- #elseif($i == 2)
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>num second<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$i<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span>
- #elseif($i == 3)
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>num third<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$i<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span>
- #else
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span>$i<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span>
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- $title
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>date<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$date<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>author<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$author<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span></code></pre>
- <h3 id="新闻排行列表">新闻排行列表</h3><blockquote><p>使用这个的时候,文章页的内容必须带流量统计,详情请看<a title="流量统计" href="#流量统计">流量统计</a>,另外也注意这里排行是指文章的阅读量排行,跟下面的视频排行的统计方法是不一样的</p></blockquote><p><code>调用语法参数说</code></p><table>
- <thead>
- <tr><th>名字</th>
- <th>描述</th>
- <th>备注</th>
- </tr></thead><tbody>
- <tr><td>频道id/频道中文名</td>
- <td>专区名字或中文名</td>
- <td></td>
- </tr><tr><td>tag</td>
- <td>获取排名的标签</td>
- <td></td>
- </tr><tr><td>start</td>
- <td>开始的位置</td>
- <td></td>
- </tr><tr><td>len</td>
- <td>获取的数量</td>
- <td></td>
- </tr><tr><td>startTime</td>
- <td>文章发表开始时间</td>
- <td>可用具体日期,格式是:yyyy-MM-dd 如:2011-01-01;或者相对日期 $tools.getNDateBefore(n) 前n天 可以为0或者负数,负数代表今天后,0代表今天,1代表昨天的0时</td>
- </tr><tr><td>endTime</td>
- <td>文章发表结束时间</td>
- <td>可用具体日期,格式是:yyyy-MM-dd 如: 2011-01-01;或者相对日期 $tools.getNDateLater(n) n天后 可以为0或者负数,负数代表今天前,0代表今天,1代表明天的0时</td>
- </tr><tr><td>统计类型</td>
- <td>按什么排名</td>
- <td>可选“day_statistic_article”,“week_statistic_article”,“month_statistic_article” ,分别是按天,按周,按月</td>
- </tr></tbody></table>
- <p><code>调用方法列表</code></p><pre><code>按天排名
- $data.getVoteRankDataByArticle(频道id/频道中文名,tag,start,len,"$tools.getNDateBefore(1)","$tools.getNDateLater(1)","day_statistic_article")
- 按周排名
- $data.getVoteRankDataByArticle(频道id/频道中文名,tag,start,len,"$tools.getNDateBefore(6)","$tools.getNDateLater(1)","week_statistic_article")
- 按月排名
- $data.getVoteRankDataByArticle(频道id/频道中文名,tag,start,len,"$tools.getNDateBefore(30)","$tools.getNDateLater(1)","month_statistic_article")</code></pre>
- <p><code>具体例子</code></p><pre><code>#set ($channelid='首页')
- #foreach($one in $data.getVoteRankDataByArticle("lol","重点",0,10,"$tools.getNDateBefore(1)","$tools.getNDateLater(1)","day_statistic_article"))
- #set ($reallink=$data.getUrl($channelid,$one.getString("articleid")))
- #set ($title=$one.getString("title"))
- #set ($sum=$one.sum)
- #set ($author=$one.getString('author'))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$reallink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$title<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>num<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$sum<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>author<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$author<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #end</code></pre>
- <p>需要说明 调用方法列表里面按天排名,这里写的获取文章发表时间是2天,原因是1天的话会由于时间不够,无法获取资料。</p><p>稍微需要注意的地方
- 之前的值,我们都可以用$one.getString('XXX')来获取,唯独排行榜的浏览总数不能用$one.getString('sum') ! 切记!!</p><h3 id="视频排行列表">视频排行列表</h3><blockquote><p>必要说明,这里排行的是视频的播放数!!!文章的排行榜参考 <a title="新闻排行列表" href="#新闻排行列表">新闻排行列表</a></p></blockquote><p><code>必须在头部写</code></p><pre><code>#set ($myChannelId="专区channelid")
- #set ($getInfoByArticleId ="http://v.huya.com/?r=cmsapi/getInfoByArticleId")
- #set ($getInfoByArticleIdUrl = "${getInfoByArticleId}&channel=${myChannelId}&articleId=")
- #set ($getRankByTag = "http://v.huya.com/?r=cmsapi/getRankByTag&channel=${myChannelId}&")</code></pre>
- <p>这些是公共的,只要专区没变,就可以写一次就可以了</p><p><code>调用方法说明</code></p><p><code>$data.getJsonList("${getRankByTag}tag=tag名&sortBy=排名类别&limit=数量</code></p><table>
- <thead>
- <tr><th>参数</th>
- <th>说明</th>
- </tr></thead><tbody>
- <tr><td>tag</td>
- <td>就是tag名,例如`重点`,`游戏视频`等</td>
- </tr><tr><td>sortBy</td>
- <td>可选 `day` , `week` , `month` 分别代表按日,周,月排行</td>
- </tr><tr><td>limit</td>
- <td>获取数量 ,写个正整数就可以</td>
- </tr></tbody></table>
- <p>ex:</p><p><code>$data.getJsonList("${getRankByTag}tag=游戏视频&sortBy=day&limit=10</code></p><p><code>$data.getJsonList("${getRankByTag}tag=游戏视频&sortBy=week&limit=10</code></p><p><code>$data.getJsonList("${getRankByTag}tag=游戏视频&sortBy=month&limit=10</code></p><p><code>参数方法说明</code></p><p>跟虎牙视频列表那个是一样的</p><table>
- <thead>
- <tr><th>参数</th>
- <th>发布器语法</th>
- <th>说明</th>
- </tr></thead><tbody>
- <tr><td>视频标题</td>
- <td>#set ($vtitle=$json.get('video_title'))</td>
- <td>-</td>
- </tr><tr><td>视频副标题</td>
- <td>#set ($vsubtitle=$json.get('video_subtitle'))</td>
- <td>-</td>
- </tr><tr><td>播放总数</td>
- <td>#set ($vsum=$json.get('video_play_num'))</td>
- <td>-</td>
- </tr><tr><td>播放时长</td>
- <td>(#set ($vdur=$json.get('video_duration'))</td>
- <td>-</td>
- </tr><tr><td>播放评论数</td>
- <td>#set ($vcomment=$json.get('video_comment_num'))</td>
- <td>-</td>
- </tr><tr><td>视频封面</td>
- <td>#set ($vpic=$json.get('video_cover'))</td>
- <td>-</td>
- </tr><tr><td>用户昵称</td>
- <td>#set ($author=$json.get('nickname'))</td>
- <td>-</td>
- </tr></tbody></table>
- <p><code>具体例子(按日排名)</code></p><pre><code>#set ($myChannelId="lol")
- #set ($getInfoByArticleId ="http://v.huya.com/?r=cmsapi/getInfoByArticleId")
- #set ($getInfoByArticleIdUrl = "${getInfoByArticleId}&channel=${myChannelId}&articleId=")
- #set ($getRankByTag = "http://v.huya.com/?r=cmsapi/getRankByTag&channel=${myChannelId}&")
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>m-list<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- #set ($i=1)
- #foreach($json in $data.getJsonList("${getRankByTag}tag=游戏视频&sortBy=day&limit=10))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span> <span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>num<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$i<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>i</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$json.get('video_url')<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$tools.substring($json.get('video_title'),0,30)<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #set ($i=$i+1)
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span></code></pre>
- <p>稍微需要注意的地方
- 虎牙视频列表排行没有文章阅读量的概念,只有<code>视频播放数</code>的概念,值为<code>vsum</code></p><h3 id="跨专区调用文章列表">跨专区调用文章列表</h3><p>只需要把getList换成getListOther,加上所跨专区的名字即可,其他是一样的,如</p><p><code>$data.getListOther("首页","试玩",60,255,4))</code></p><p>神坑见这里 <a title="跨专区神坑" href="#跨专区调用神坑">跨专区神坑</a>
- 神坑见这里 <a title="跨专区神坑" href="#跨专区调用神坑">跨专区神坑</a>
- 神坑见这里 <a title="跨专区神坑" href="#跨专区调用神坑">跨专区神坑</a></p><p>重要的事情说三遍!!</p><h3 id="调用多个tag文章列表">调用多个tag文章列表</h3><p>在最终文章页的话可以直接写$tags,非最终文章页tag之间用“,”隔开即可</p><p>本专区ex:</p><pre><code>$data.getList($tags,,60,255,4)或
- $data.getList("试玩,解说,图集,视频",60,255,4)) 或
- $data.getRelate($tags,显示数量) 或
- $data.getRelate("试玩,解说,图集,视频",显示数量)或
- $data.getRelate("试玩,解说,图集,视频",权重开始,权重结束,显示数量)</code></pre>
- <p>跨专区ex:</p><p><code>$data.getListOther("首页","试玩,解说,图集,视频",60,255,4))</code>
- <code>$data.getListOther("首页",$tags,60,255,4))</code></p><p>神坑见这里 <a title="跨专区神坑" href="#跨专区调用神坑">跨专区神坑</a>
- 神坑见这里 <a title="跨专区神坑" href="#跨专区调用神坑">跨专区神坑</a>
- 神坑见这里 <a title="跨专区神坑" href="#跨专区调用神坑">跨专区神坑</a>
- 重要的事情说三遍!!</p><h2 id="评论系统">评论系统</h2><p>哪里需要评论就在哪里写上<code>$comment</code>,直接写上就可以,不需要跟以前一样改个什么id,现在会随机生成的了。</p><pre><code><span class="token comment" spellcheck="true"><!-- 通用评论{ --></span>
- $comment
- <span class="token comment" spellcheck="true"><!-- }通用评论 --></span></code></pre>
- <p>评论出问题请找<code>李响(YY:909010159)</code></p><h3 id="新增手动换评论皮肤">新增手动换评论皮肤</h3><p>一般来说$comment 都可以直接获得评论,但是之前的话修改皮肤都需要去找响哥,现在有了新的方法可以让编辑自己手动去修改评论的皮肤
- 在comment前面增加如下代码</p><pre><code class="lang-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span><span class="token punctuation">></span></span>
- var __comment3Skin__='dw-comment-skin_black';
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span></code></pre>
- <p>传统默认是白色的,可选的颜色有黄色<code>dw-comment-skin_yellow</code>、黑色<code>dw-comment-skin_black</code>、蓝色<code>dw-comment-skin_black</code>、深蓝色<code>dw-comment-skin_deepblu</code>
- 使用方法是替换掉前面的颜色<code>dw-comment-skin_black</code>就可以了</p><p>完整代码</p><pre><code class="lang-html">假如我需要换成黑色
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span><span class="token punctuation">></span></span>
- var __comment3Skin__='dw-comment-skin_black';
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span>
- <span class="token comment" spellcheck="true"><!-- 通用评论{ --></span>
- $comment
- <span class="token comment" spellcheck="true"><!-- }通用评论 --></span></code></pre>
- <h2 id="pk系统">pk系统</h2><p><code>具体例子</code></p><p><img alt="pk系统" src="img/cms/high/pk.jpg" title="pk系统"></p><p><code>具体代码</code></p><pre><code><span class="token comment" spellcheck="true"><!-- 话题PK容器{ --></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>pk_con<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>plm<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token comment" spellcheck="true"><!--cont--></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>cont1 clearfix<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>pk_box clearfix<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>左侧图片路径<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>R<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>T<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>左侧标题<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span><span class="token punctuation">></span></span>左侧描述<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token comment" spellcheck="true"><!--R--></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token comment" spellcheck="true"><!--pk_box--></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>pk_box clearfix<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>img</span> <span class="token attr-name">alt</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>右侧图片路径<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>R<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>T<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>右侧标题<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span><span class="token punctuation">></span></span>右侧描述<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token comment" spellcheck="true"><!--R--></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token comment" spellcheck="true"><!--pk_box--></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>blank20<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>livepk-container<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token comment" spellcheck="true"><!-- }话题PK容器 --></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>blank10<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token comment" spellcheck="true"><!-- 话题PK脚本{ --></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>text/javascript<span class="token punctuation">"</span></span> <span class="token attr-name">charset</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>utf-8<span class="token punctuation">"</span></span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://hudong.duowan.com/livepk/gem-application/app-host.js<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>text/javascript<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- window["webyy\x24ui_scheme"] = "livepk2";
- window["webyy\x24topic_id"] = "模板id";
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span>
- <span class="token comment" spellcheck="true"><!-- }话题PK脚本 --></span></code></pre>
- <h2 id="图集系统">图集系统</h2><p>自行上多玩图集的后台生成即可,有疑问的话可以咨询自己项目组的前辈</p><p>图集出现其他问题的话请联系图集负责人<code>梁曜麒(YY:909011383)</code></p><h2 id="点赞类功能">点赞类功能</h2><p>比较建议使用新的方法去实现这个功能,原因是新的容易维护,旧的因为人员离职的原因,使得代码维护困难,而且无法实现很多的效果。</p><h3 id="新的点赞接口">新的点赞接口</h3><p>已经出了新的点赞系统了,需要的话你直接跳转到<a title="点赞api" href="zan.html">点赞api</a></p><p>点赞/投票/支持数以及其他类似的功能均可以使用</p><p><code>效果如图</code></p><p><img alt="问题2" src="img/cms/vote/vote1.jpg" title="投票1"> <img alt="问题2" src="img/cms/vote/vote2.jpg" title="投票2"> <img alt="问题2" src="img/cms/vote/vote3.jpg" title="投票3"></p><h3 id="旧的点赞接口">旧的点赞接口</h3><p>强烈不建议使用旧的接口。</p><p>这里需要分成种情况,一直是文章页,一种是非文章页,文章页可以根据文章的id获取唯一性,在非文章页的时候最好可以在文章id那里改成时间戳保证唯一性,时间戳格式可以但不一定是<code>年+月+日+时+分+秒+随机3个数字</code>,例如现在是20150918165202555</p><p><code>发布器代码结构说明</code></p><p>id为ding的下面所有input的id以及span的id均不能改变!!!
- id为ding的下面所有input的id以及span的id均不能改变!!!
- id为ding的下面所有input的id以及span的id均不能改变!!!
- “//”后面为说明,必须看,在发布器的时候切记删除</p><pre><code><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://news.duowan.com/s/i/vote2.js<span class="token punctuation">"</span></span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>text/javascript<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span> //必须得有
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://news.duowan.com/s/i/xpath2.js<span class="token punctuation">"</span></span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>text/javascript<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span> //必须得有
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>module__btnGroup<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>ding<span class="token punctuation">"</span></span><span class="token punctuation">></span></span> //必须得有 切id不能变
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>type<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>2<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span> //必须得有 且数值为2 不允许改变
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>articleId<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>306152382848<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span> //文章id 非文章页直接写个时间戳就可以 文章页直接写$articleid
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>channelId<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>df<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span> //频道id 文章页直接写$channelid
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>tag<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>normal<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span> //必须得有 值必须改变 非文章页 当前文章所属tag 如重点等或者随便写一个 文章页 $tags
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>title<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>errorTitle<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>//必须得有 值必须改变 非文章页直自己写个标题,文章页写$title
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>url<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>errorUrl<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span> //必须得有 值必须改变 非文章页直自己填写url,文章页写$data.getUrl($channelid,$articleid)
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>encode<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>utf-8<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span> //必须得有 值不允许改变
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>radio<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>choice<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>1<span class="token punctuation">"</span></span> <span class="token attr-name">style</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>display:none<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span> //必须得有
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://bbs.duowan.com/thread-43679006-1-1.html<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>module__download<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>点击下载<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span> 非必须
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>javascript:;<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>module__support<span class="token punctuation">"</span></span> <span class="token attr-name">onclick</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>voteRadio(1,'ding',0,0)<span class="token punctuation">"</span></span> <span class="token attr-name">target</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>_self<span class="token punctuation">"</span></span><span class="token punctuation">></span></span> //触发条件 voteRadio(1,'ding',0,0) 必须且不允许改变
- 支持他
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>span1<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>0<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span> //输出数值 必须为span标签且id必须为span1
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span> <span class="token attr-name">language</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>javascript<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- getValue("ding");
- voteRadio(1,'ding',1,0);
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span></code></pre>
- <h3 id="最终文章投票">最终文章投票</h3> <script src="http://news.duowan.com/s/i/vote2.js" type="text/javascript"></script>
- <script src="http://news.duowan.com/s/i/xpath2.js" type="text/javascript"></script>
- <pre><code><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>module__btnGroup<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>ding<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>type<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>2<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>articleId<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$articleid<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>channelId<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$channelid<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>tag<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span> $tags<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>title<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>url<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$data.getUrl($channelid,$articleid)<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>encode<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>utf-8<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>radio<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>choice<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>1<span class="token punctuation">"</span></span> <span class="token attr-name">style</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>display:none<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://bbs.duowan.com/thread-43679006-1-1.html<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>module__download<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>点击下载<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span> 非必须
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>javascript:;<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>module__support<span class="token punctuation">"</span></span> <span class="token attr-name">onclick</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>voteRadio(1,'ding',0,0)<span class="token punctuation">"</span></span> <span class="token attr-name">target</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>_self<span class="token punctuation">"</span></span><span class="token punctuation">></span></span> //触发条件 voteRadio(1,'ding',0,0) 必须且不允许改变
- 支持他
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>span1<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>0<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span> <span class="token attr-name">language</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>javascript<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- getValue("ding");
- voteRadio(1,'ding',1,0);
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span></code></pre>
- <h3 id="非最终文章投票">非最终文章投票</h3><p>下面的值必须替换!!!!
- 下面的值必须替换!!!!
- 下面的值必须替换!!!!</p> <script src="http://news.duowan.com/s/i/vote2.js" type="text/javascript"></script>
- <script src="http://news.duowan.com/s/i/xpath2.js" type="text/javascript"></script>
- <pre><code><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>module__btnGroup<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>ding<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>type<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>2<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>articleId<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>年+月+日+时+分+秒+任意3个数字<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>channelId<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>频道id(英文)<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>tag<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span> 任意一个tag名字<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>title<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>标题<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>url<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>文章地址<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>encode<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>utf-8<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>radio<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>choice<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>1<span class="token punctuation">"</span></span> <span class="token attr-name">style</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>display:none<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://bbs.duowan.com/thread-43679006-1-1.html<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>module__download<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>点击下载<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span> 非必须
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>javascript:;<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>module__support<span class="token punctuation">"</span></span> <span class="token attr-name">onclick</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>voteRadio(1,'ding',0,0)<span class="token punctuation">"</span></span> <span class="token attr-name">target</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>_self<span class="token punctuation">"</span></span><span class="token punctuation">></span></span> //触发条件 voteRadio(1,'ding',0,0) 必须且不允许改变
- 支持他
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>span1<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>0<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span> <span class="token attr-name">language</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>javascript<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- getValue("ding");
- voteRadio(1,'ding',1,0);
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span></code></pre>
- <h2 id="发布器高阶学习">发布器高阶学习</h2><h3 id="条件语句">条件语句</h3><p><code>适用范围</code></p><p>当出现结构并不完全一致时,我们就需要用条件语句来达到我们的目的,<code>新闻列表</code>前3个需要变色[<a title="点我查看" href="#带序号新闻列表">点我查看</a>]或者<code>幻灯片</code>中的第一个处于激活状态,其他的处于非激活状态[<a title="幻灯片激活" href="#普通的轮播图">幻灯片激活</a>],tab导航的激活等等。</p><p><code>配置参数</code></p><table>
- <thead>
- <tr><th>名称</th>
- <th>说明</th>
- <th>例子</th>
- </tr></thead><tbody>
- <tr><td>#if (条件)</td>
- <td>必须写。条件开始,条件可以选择大于>,大于等于>=,小于<,小于等于<=,等于==,不等于!= ,可以用&&表示同时成立把两种以上条件连接起来或者用 | | 表示只需要成立一个就可以</td>
- <td>#if ($i > 1 && $i3< 3)</td>
- </tr><tr><td>#elseif (条件)</td>
- <td>可选,代表二级条件</td>
- <td>`#if ($i==1) 执行语句 #elseif ($i==2) 执行语句 `</td>
- </tr><tr><td>#else</td>
- <td>条件不成立的情况</td>
- <td>略</td>
- </tr><tr><td>#end</td>
- <td>必须写结束if</td>
- <td>#if ($ > 1) xxxx #end</td>
- </tr></tbody></table>
- <p><code>注意#if/#endif 跟条件之间都是有空格的</code></p><p><code>完整例子</code></p><pre><code> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- #if ($i ==1 )
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>num first<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$i<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span>
- #elseif($i == 2)
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>num second<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$i<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span>
- #elseif($i == 3)
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>num third<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$i<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span>
- #else
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span>$i<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span><span class="token punctuation">></span></span>
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$thislink<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- $title
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>date<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$date<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>author<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$author<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span></code></pre>
- <h3 id="新闻列表自动关联tag">新闻列表自动关联tag</h3><blockquote><p>这个功能是后来一些产品提出的新需求,必须要设计师这边提供tag的设计图以及跟产品提供关联的逻辑。</p></blockquote><p><code>真实的例子</code></p><p><a title="英雄联盟新闻部分" href="http://lol.duowan.com/" target="_blank">英雄联盟新闻部分</a></p><p><a title="tvgame" href="http://tv.duowan.com/" target="_blank">TVGAME</a></p><p><a title="TGS2015专题-视频汇总" href="http://tv.duowan.com/tgs2015/index.html" target="_blank">TGS2015专题-视频汇总</a></p><p><img alt="tags1" src="img/cms/high/tag.jpg" title="tags关联"></p><p><code>关联逻辑</code></p><p>这里以英雄联盟为例子
- 现给出5个tag:独家、杂谈、精美图片、游戏视频、重点 , 权重从高到低,这个是产品那边提供的。
- 对应的标签按照权重高低分别输出独家,杂谈,图片,视频,资讯的标签。</p><p><code>匹配规则</code></p><ol><li>tags组里面的tag可以同时出现1个或以上,不存在的话需要特别说明;
- </li>
- <li>如果<code>独家</code>、<code>杂谈</code>、<code>精美图片</code>、<code>游戏视频</code>,有且只有一个被匹配到了,那么就显示相应的标签;
- </li>
- <li>如果5个都没被匹配到,就显示<code>资讯</code>;
- </li>
- <li>如果二个或以上被匹配得到的话,那么就按照权重的高低显示权重最高的标签。例如如果一个标签有<code>独家</code>跟<code>杂谈</code>,因为独家的顺序排在杂谈前面,所以就显示<code>独家</code>的标签,其他的也是类似.
- </li></ol>
- <p>例如 某篇文章包含了如下tag:<code>重点</code> <code>电子竞技</code> <code>赛事新闻</code> <code>S5总决赛资讯</code> <code>盒子新闻</code> <code>战队</code> <code>Fnatic战队新闻</code>,按照权重高低匹配的原则,他不包含给出的5个tag,
- 所以就会显示<code>资讯</code>的标签</p><p>例如 某篇文章包含了如下tag:<code>游戏视频</code> <code>盒子推荐</code> <code>比赛视频</code> <code>S5总决赛视频</code> <code>电子竞技</code> <code>赛事新闻</code> <code>S5总决赛资讯</code> <code>娱乐集锦视频</code> <code>重点</code>, 按照权重高低匹配的原则,
- 就会显示<code>视频</code>的标签</p><p><code>具体代码</code></p><pre><code><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>m-list<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- #set ($tagsArr="独家,杂谈,精美图片,游戏视频,重点")
- #set ($list=$data.getList("重点",60,255,0,5))
- #foreach ($one in $list)
- #set ($taglink = $data.getRelatedUrl($one.getString("articleid")))
- #set ($title=$one.getString("title"))
- #set ($d=$tools.parseTime($one.getString("posttime"),"M.D"))
- #set ($tags =$one.getString('alltag'))
- #set ($color=$one.getString("titlecolor"))
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span>
- #foreach ($onetag in $tools.split($tagsArr,","))
- #set ($index = $tools.IndexOfArray($tags,$onetag))
- #if ($index != -1)
- #if($onetag == '独家')
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>icon-label-dujia<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>i</span><span class="token punctuation">></span></span>
- #elseif ($onetag == '杂谈')
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>icon-label-zatan<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>i</span><span class="token punctuation">></span></span>
- #elseif ($onetag == '精美图片')
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>icon-label-pic<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>i</span><span class="token punctuation">></span></span>
- #elseif ($onetag == '游戏视频')
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>icon-label-video<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>i</span><span class="token punctuation">></span></span>
- #else
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>icon-label-zixun<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>i</span><span class="token punctuation">></span></span>
- #end
- #break
- #end
- #end
- #if ($index == -1) //文章必定包含tag,可以删除这一行
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>i</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>icon-label-zixun<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>i</span><span class="token punctuation">></span></span> //文章必定包含tag,可以删除这一行
- #end //文章必定包含tag,可以删除这一行
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>date<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$d<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$taglink<span class="token punctuation">"</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span> <span class="token attr-name">style</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>color:$color<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>$title<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>a</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>
- #end
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span></code></pre>
- <p><code>代码说明</code></p><p>这里可能会用到条件语句的知识,建议回去看一下<a title="条件语句" href="#条件语句">条件语句</a>
- 使用方法还是跟普通的发布器语法调用是一样的,忘记了的话可以回顾<a title="使用方法" href="###使用方法">使用方法</a></p><p>需要添加tag或者删除tag的话直接在tagsArr删除就可以了
- 但是要添加tag的话,就要同步添加<code>#elseif ($onetag == 'xx')</code> 到23行跟24行的位置</p><h3 id="截字功能">截字功能</h3><p>假如我调用摘要的时候,只想显示n个字符的时候,那么就需要用到了</p><p><code>参数说明</code></p><table>
- <thead>
- <tr><th>名称</th>
- <th>说明</th>
- </tr></thead><tbody>
- <tr><td>str</td>
- <td>必填,需要截字的字符串</td>
- </tr><tr><td>start</td>
- <td>可选,开始位置,不写的话就是从0开始</td>
- </tr><tr><td>end</td>
- <td>必填,结束位置</td>
- </tr></tbody></table>
- <p><code>使用方法</code></p><p><code>$tools.substring(str,start,end)</code></p><p><code>使用例子</code></p><pre><code>#set ($digest=$one.getString("digest")) //获取需要截字的内容
- #set ($cutWord=$tools.substring($digest,0,20))</code></pre>
- <p>截取的内容页不一定是摘要,还可以是其他,更多详细内容请看<a title="非最终文章页" href="#非最终文章页">非最终文章页</a>的参数列表</p><h3 id="调用论坛数据">调用论坛数据</h3><ol><li><p>先进入多玩论坛管理后台
- <img alt="多玩论坛管理后台" src="img/cms/high/bbs-2.jpg" title="多玩论坛管理后台"></p></li>
- <li><p>在调用数据的模板样式哪里按照说明写好结构
- <img alt="多玩论坛管理后台" src="img/cms/high/bbs-3.jpg" title="多玩论坛管理后台"></p></li>
- <li><p>在最下面会生成一段代码,直接复制这段代码过去发布器就可以了
- <img alt="调用论坛数据" src="img/cms/high/bbs-4.jpg" title="调用论坛"></p></li></ol>
- <p><code>{[包含=/public/bbs_news/xxx.html]}</code></p><p>这个xxx.html可以直接由论坛后台生成就可以,不会的话可以问下自己上一级同事</p><h3 id="跨专区调用模板">跨专区调用模板</h3><p><code>传统做法</code></p><p>在公共专区建立一个模板,然后在其他专区调用的时候写<code>{[动态公共模板=公共模板名]}</code></p><p>例如公共专区有一个模板为<code>首页精彩推荐</code>,那样其他专区调用的时候就可以写成<code>{[动态公告模板=首页精彩推荐]}</code></p><p><code>缺陷</code></p><p>公共模版一改,调用他的模版也得去手动刷一遍才会更新内容</p><p><code>推荐的方法</code></p><p>例如a专区b模板想要调用b专区的d模板</p><p>把d模板的分类改成公共,如图所示:
- <img alt="该分类公共" src="img/cms/high/kuazhuanqu.jpg"></p><p>在a专区的b里面引入模板写成 <code>{[公共模板=b:d模板名]}</code></p><p>跨专区引用模板的格式为:<code>{[公共模板=专区名字:类型为公共的专区模板名字]}</code></p><p><code>切记</code>
- 用第2种方法的时候,模板的类型必须为公共</p><h3 id="流量统计">流量统计</h3><blockquote><p>仅仅是用来收集数据,不做其他用途。但是,只要你需要调用文章浏览数据,无论在文章页调用还是栏目,标签页调用,都得需要加上流量统计代码</p></blockquote><p>通过流量统计可以实现的内容如上面的<a title="排行新闻列表" href="#排行新闻列表">排行新闻列表</a>
- 流量统计有3种,一种是只能放在最终文章页,一种是放在任何栏目,专题模板,或者最终文章页引用模板</p><h4 id="最终文章页--流量统计">最终文章页--流量统计</h4><ol><li>引入两个js
- </li></ol>
- <pre><code class="lang-html"> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://www.duowan.com/public/s/i/voteall.js<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://www.duowan.com/public/s/i/xpath2.js<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span></code></pre>
- <ol><li>放在页面最后
- </li></ol>
- <pre><code class="lang-html"> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>statistics<span class="token punctuation">"</span></span> <span class="token attr-name">style</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>display:none;<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>type<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>5<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>articleId<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$articleid<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>channelId<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$channelid<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>tag<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>statistics<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>title<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>url<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$data.getUrl($channelid,$articleid)<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>picurl<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$picurl<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>encode<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>utf-8<span class="token punctuation">"</span></span><span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span> <span class="token attr-name">language</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>javascript<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- statisticsRadio(1, 'statistics', 0, 0);
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span></code></pre>
- <h4 id="非最终文章页--流量统计">非最终文章页--流量统计</h4><ol><li>引入两个js
- </li></ol>
- <pre><code class="lang-html"> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://www.duowan.com/public/s/i/voteall.js<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://www.duowan.com/public/s/i/xpath2.js<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span></code></pre>
- <ol><li>必须放在最终文章页
- </li></ol>
- <pre><code class="lang-html"> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>duowan.articleid<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$articleid<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>duowan.channelid<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$channelid<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>duowan.title<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$title<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>duowan.url<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$data.getUrl($channelid,$articleid)<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>duowan.picurl<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>$picurl<span class="token punctuation">"</span></span><span class="token punctuation">></span></span></code></pre>
- <ol><li>放到栏目或者其他地方的
- </li></ol>
- <pre><code class="lang-html"> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>statistics<span class="token punctuation">"</span></span> <span class="token attr-name">style</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>display: none;<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>type<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>5<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>articleId<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>channelId<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>tag<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>statistics<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>title<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>url<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>picurl<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>input</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>hidden<span class="token punctuation">"</span></span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>encode<span class="token punctuation">"</span></span> <span class="token attr-name">value</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>utf-8<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span> <span class="token attr-name">language</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>javascript<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
- getValue("statistics");
- statisticsRadio(1, 'statistics', 0, 0);
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span>
- <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span></code></pre>
- <h4 id="动态调用浏览数">动态调用浏览数</h4><p>这里的动态调用浏览数只能放在最终文章页用,其他地方均不可使用
- <code>效果图</code></p><p><img alt="排行" src="img/cms/high/sort.jpg"></p><p><code>使用方法</code></p><ol><li><p>引入js</p><pre><code class="lang-html"> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://www.duowan.com/public/s/i/vote_statistics.js<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span></code></pre>
- <ol><li>添加一个id为articleClickNum元素(span,div)
- </li></ol>
- <pre><code class="lang-html"> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>articleClickNum<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>浏览数:<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span></code></pre>
- </li></ol>
- <h3 id="获取json数据">获取Json数据</h3><p><code>前景分析</code></p><p>这里发部分都是由前端来完成的,使用json来获取数据,是考虑到了seo的需要,需要静态输出模板,如果是用js的话不利于搜索引擎的抓取</p><p><code>语法</code></p><p><code>#set ($json = $data.getJsonData("json地址")</code></p><p>调用的时候就直接是
- $json.get("变量的名字")</p><p>下面以获取虎牙视频的内容为例子</p><pre><code>#set ($json = $data.getJsonData("http://v.huya.com/?r=cmsapi/getInfoByArticleId&channel=lol&&articleId=$one.getString("articleid")"))
- #set ($vtitle=$json.get("video_title"))
- #set ($vsubtitle=$json.get("video_subtitle"))
- #set ($vsum=$json.get("video_play_num"))
- #set ($vdur=$json.get("video_duration")
- #set ($vcomment=$json.get("video_comment_num"))</code></pre>
- <h3 id="换一换功能">换一换功能</h3><p>现在部分专区在图片、新闻、视频上会有一种需求是实现换一换的功能,
- 目前来说发布器是不提供这样子的功能的,如果js的去参与(需要seo的话,请选择上文提过的json获取数据),发布器去配合。
- 这里的话由<code>前端</code>来参与,不建议产品。编辑自己来完成。
- <code>例子</code></p><p><img alt="换一换功能" src="img/cms/change/change.jpg"></p><p><code>实现逻辑</code></p><ol><li>在发布器的时候,需要建立一个别名是.json的模板,里面的内容就是普通发布器语法调用,只不过是写成json模式,如图所示;
- <img alt="换一换功能" src="img/cms/change/change2.jpg">
- </li>
- <li>如果是需要seo的话,首次加载请选择json获取的办法去填充内容,后续的换一换功能选择用js操作。
- </li></ol>
- <p><code>要注意的地方</code></p><ol><li>如果数据需要刷新的话,请选择加入动态刷新模板,具体请参考<a title="数据没有更新" href="#数据没有更新">数据没有更新</a>;
- </li>
- <li>换一换的时候,需要刚换什么内容,请尽量跟产品,编辑商量好,下一次的随机是否会出现上次出现过的,等等。
- </li></ol>
- <p>如果确实需要参考的话,可以看下<a title="新游戏换一换" href="http://newgame.duowan.com/" target="_blank">新游戏</a>,进行一个参考。这里的话只给出一种思路,不做详细代码说明</p><h2 id="qa">Q&A</h2><h3 id="qa说明">Q&A说明</h3><p>当发现问题的时候请把出现问题的<code>外部url</code>、<code>模板url</code>、<code>出现问题的地方</code>,告诉技术,如果是连接前端的话需要加上<code>浏览器类型</code>
- 以便于技术人员能够快速的定位问题</p><p><code>错误示范</code></p><p><img alt="错误示范" src="img/cms/ques/q0-1.jpg"></p><p>这样子无模板无页面,技术人员没办法直接定位到问题,还得去帮你去定位,去找到这个模板页面,耗费时间不说,还容易打断手头上的工作</p><p><code>正确示范</code></p><p><img alt="错误示范" src="img/cms/ques/q0-2.jpg"></p><p>有理有据,有来源,这样定位问题都会变得非常的方便。</p><p>另外,如果是调用不了数据的,请找<code>吴杰华(YY号:909074074,手机号:13512774985)</code>,
- 如果是显示出问题的,可以找<code>李建军(YY号:909074074,手机号:18319696166)</code>、<code>李昕亮(YY号:909014161)</code></p><h3 id="样式不是显示最新的">样式不是显示最新的</h3><p><code>问题分析</code></p><p>这种通常都是由于样式文件或者模板文件未能及时更新导致</p><p><code>解决办法</code></p><p>下面提供几种办法:
- 1. 清理浏览器缓存
- 1. 进入专区,在<code>头部</code>选择<code>其他操作</code>,下拉菜单选择<code>常用刷新</code>,如图所示:</p><p><img alt="问题1" src="img/cms/ques/q1-1.jpg" title="样式最新问题"></p><p><code>输入这个url点击刷新即可</code></p><p><img alt="问题1" src="img/cms/ques/q1-2.jpg" title="样式最新问题">
- 1. 重新提交模板
- 1. 在样式表后面增加事件戳,仅限于css,js,html文件,对于不是这个格式的请勿操作,示例如图
- <img alt="问题1" src="img/cms/ques/q1-3.jpg" title="样式最新问题">
- 格式是后面接个时间</p><p><code>均无法解决请联系李建军(YY号:909013894)</code></p><h3 id="出来的结构不对">出来的结构不对</h3><p>发布器代码写好了,但是不是我想要的,例如</p><p><img alt="问题2" src="img/cms/ques/q2-1.jpg" title="样式最新问题"></p><p><code>问题分析</code></p><p>这种同样都是因为在写发布器代码的时候把样式错误漏掉导致的。<code>原结构</code>如下:</p><p><img alt="问题2" src="img/cms/ques/q2-2.jpg" title="样式最新问题"></p><p>发布器中<code>错误的结构</code></p><p><img alt="问题2" src="img/cms/ques/q2-3.jpg" title="样式最新问题"></p><p><code>解决办法</code></p><p>调用结构改回去正常的即可</p><p><img alt="问题2" src="img/cms/ques/q2-4.jpg" title="样式最新问题"></p><p>就会发现问题被解决了</p><p><img alt="问题2" src="img/cms/ques/q2-5.jpg" title="样式最新问题"></p><p>结构问题可以直接翻看<a title="发布器的基本调用" href="#发布器的基本调用">发布器语法说明</a></p><p><code>均无法解决请联系李建军(YY号:909013894)</code></p><h3 id="评论皮肤好丑">评论皮肤好丑</h3><p>直接找<code>李响 (YY: 909010159)</code>,或者去看<a title="发布器调用评论" href="#评论系统">评论调用</a></p><h3 id="调用不了文章的浏览数">调用不了文章的浏览数</h3><p>请参考<a title="流量统计" href="#流量统计">流量统计</a>,看下是否有添加统计代码
- 然后看下调用的方法是否有错<a title="动态调用浏览数" href="#动态调用浏览数">浏览数调用代码</a></p><h3 id="数据没有更新">数据没有更新</h3><table>
- <thead>
- <tr><th>申请目的</th>
- <th>邮件收件人</th>
- <th>邮件抄送</th>
- <th>是否需要上级肖燕邮件回复同意确认</th>
- <th>邮件格式模板</th>
- </tr></thead><tbody>
- <tr><td>自动刷新模版</td>
- <td>wujiehua@yy.com;</td>
- <td>你的上级的邮箱</td>
- <td>不需要</td>
- <td>[申请自动刷新模版邮件模版](http://ceshi.duowan.com/important/apply_flush.doc "申请自动刷新模版邮件模版")</td>
- </tr></tbody></table>
- <p>按照申请模板申请下就可以了</p><h3 id="列表页列表图更新">列表页/列表图更新</h3><p>把原来分类为<code>标签</code>的旧列表页分类改为<code>栏目</code>,把新的列表页分类从<code>栏目</code>改成<code>标签</code>;</p><p>把原来分类为<code>标签图</code>的旧列表图分类改为<code>栏目</code>,把新的列表图分类从<code>栏目</code>改成<code>标签图</code>;</p><p><code>具体例子</code></p><p>原标签,标签图
- <img alt="原标签" src="img/cms/ques/q3-1.jpg" title="原标签"></p><p>新标签,新签图
- <img alt="原标签" src="img/cms/ques/q3-2.jpg" title="原标签"></p><p><code>更改后并没有刷新</code>
- 联系<code>吴杰华(YY号:909074074,手机号:13512774985)</code>,他会帮你删除旧的标签页,标签图然后生成新的标签页标签图</p>
-
- </section>
-
- </div>
- <div class="search-results">
- <div class="has-results">
-
- <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
- <ul class="search-results-list"></ul>
-
- </div>
- <div class="no-results">
-
- <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
-
- </div>
- </div>
- </div>
- </div>
- </div>
-
- </div>
-
-
- <a href="./" class="navigation navigation-prev navigation-unique" aria-label="Previous page: 发布器简介">
- <i class="fa fa-angle-left"></i>
- </a>
-
-
-
-
- </div>
- <script>
- var gitbook = gitbook || [];
- gitbook.push(function() {
- gitbook.page.hasChanged({"page":{"title":"发布器调用大全","level":"1.6.1","depth":2,"next":{"title":"实用技巧","level":"1.6.2","depth":2,"ref":"","articles":[{"title":"定位相关","level":"1.6.2.1","depth":3,"path":"cms/locate.md","ref":"cms/locate.md","articles":[]},{"title":"引用模板","level":"1.6.2.2","depth":3,"path":"cms/quote.md","ref":"cms/quote.md","articles":[]},{"title":"预览地址和正式地址","level":"1.6.2.3","depth":3,"path":"cms/addredss.md","ref":"cms/addredss.md","articles":[]},{"title":"刷新模板","level":"1.6.2.4","depth":3,"path":"cms/flesh.md","ref":"cms/flesh.md","articles":[]}]},"previous":{"title":"发布器简介","level":"1.6","depth":1,"path":"cms/README.md","ref":"cms/README.md","articles":[{"title":"发布器调用大全","level":"1.6.1","depth":2,"path":"cms/all.md","ref":"cms/all.md","articles":[]},{"title":"实用技巧","level":"1.6.2","depth":2,"ref":"","articles":[{"title":"定位相关","level":"1.6.2.1","depth":3,"path":"cms/locate.md","ref":"cms/locate.md","articles":[]},{"title":"引用模板","level":"1.6.2.2","depth":3,"path":"cms/quote.md","ref":"cms/quote.md","articles":[]},{"title":"预览地址和正式地址","level":"1.6.2.3","depth":3,"path":"cms/addredss.md","ref":"cms/addredss.md","articles":[]},{"title":"刷新模板","level":"1.6.2.4","depth":3,"path":"cms/flesh.md","ref":"cms/flesh.md","articles":[]}]},{"title":"常用语法","level":"1.6.3","depth":2,"ref":"","articles":[{"title":"语法核心","level":"1.6.3.1","depth":3,"path":"cms/alert.md","ref":"cms/alert.md","articles":[]},{"title":"图片列表","level":"1.6.3.2","depth":3,"path":"cms/piclist.md","ref":"cms/piclist.md","articles":[]},{"title":"排行榜","level":"1.6.3.3","depth":3,"path":"cms/rank.md","ref":"cms/rank.md","articles":[]},{"title":"多玩视频","level":"1.6.3.4","depth":3,"path":"cms/dwvideo.md","ref":"cms/dwvideo.md","articles":[]},{"title":"虎牙视频","level":"1.6.3.5","depth":3,"path":"cms/huyavideo.md","ref":"cms/huyavideo.md","articles":[]}]},{"title":"专区嵌套","level":"1.6.4","depth":2,"path":"cms/special.md","ref":"cms/special.md","articles":[{"title":"首页","level":"1.6.4.1","depth":3,"path":"cms/index.md","ref":"cms/index.md","articles":[]},{"title":"标签和标签图","level":"1.6.4.2","depth":3,"path":"cms/tag.md","ref":"cms/tag.md","articles":[]},{"title":"文章页","level":"1.6.4.3","depth":3,"path":"cms/art.md","ref":"cms/art.md","articles":[]}]}]},"dir":"ltr"},"config":{"plugins":["prism","-highlight"],"styles":{"website":"styles/website.css"},"pluginsConfig":{"prism":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":false,"twitter":false,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":[]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"level_number":true,"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"links":{"sharing":{"all":false,"google":false,"facebook":false,"twitter":false,"weibo":false}},"gitbook":"3.2.0"},"file":{"path":"cms/all.md","mtime":"2016-11-24T06:09:45.000Z","type":"markdown"},"gitbook":{"version":"3.2.0","time":"2018-03-19T02:13:33.701Z"},"basePath":"..","book":{"language":""}});
- });
- </script>
- </div>
-
- <script src="../gitbook/gitbook.js"></script>
- <script src="../gitbook/theme.js"></script>
-
-
- <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
-
-
-
- <script src="../gitbook/gitbook-plugin-search/search.js"></script>
-
-
-
- <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
-
-
-
- <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
-
-
-
- <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
-
-
-
- <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
-
-
- </body>
- </html>
|