|
phpcms图片频道的模板制作
前面我们已经讲过了文章、下载频道的模板制作,今天讲完图片频道之后,剩下的就是专题的制作,虽然每个频道都有专题,但是制作方法都是一样的,我们讲集中讲解。好,闲话不说,开始讲课。
打开picture/index.html文件,我们就会发现都是我们前面讲过很熟悉的标签,图片频道与别的频道最大的不同,就是在显示的时候默认显示的都是缩略图,也就是我们看到的这一串标签
{$picpicture(0,$channelid,$cat[catid],1,0,0,10,30,0,0,0,3,1,0,130,100,5)}
因此我们主要来讲这个标签的制作,别的顶级栏目。终极栏目的制作和文章频道都是相同的
在picture文件夹下面以tag开头的文件有4个 tag_picpicture.html 图片缩略图调用标签 tag_picturelist.html 图片标题列表调用标签 tag_slidepicpicture.html 图片幻灯片调用标签 tag_slidepicpicture-js.html 图片js效果标签模板
打开tag_picpicture.html,我们会看到 {loop $pictures $i $picture}
$i是用来判断几列的 利用这个i来和系统设置的$cols 做比较 利用他们的余数来判断是否分行
<img src='{$picture[thumb]}' />
<a href='{$picture[url]}' target='_blank' />
这几个分别是图片的地址 图片的提示 图片的标题
{if $descriptionlen} <tr> <td>{$picture[content]} <a href='{$picture[url]}' target='_blank'>详细>></a></td> </tr> {/if}
这一句是,如果允许显示说明,则显示具体的说明信息
在tag_picturelist.html中,显示的东西则比缩略图模板要多 {$picture[img]} 标题图片 {$picture[catname]} 所属栏目 <a href="{$picture[url]}" />
{if $showhits}({$picture[hits]}){/if} 如果允许显示点击数,则显示点击数 {if $showauthor}[作者:{$picture[author]}]{/if} 显示作者 {if $datetype}[<span>{$picture[adddate]}</span>]{/if} 显示添加时间 {if $descriptionlen}{$picture[content]}{/if} 显示说明
图片内容页content.html的制作 打开这个网页 <script language=javascript type=text/javascript> function fontZoom(size) { document.getElementById('{$addtime}l').style.fontSize=size 'px' } var pictureurl=new Array(); var picturename=new Array(); {loop $pictureurls $id $pic} pictureurl[{$id}] = "{$pic[url]}"; picturename[{$id}] = "{$pic[name]}"; {/loop} </script>
这个js函数是字体缩放函数
<!--图片浏览JS开始--> <script language=JavaScript> <!-- Begin var rotate_delay =4000; // delay in milliseconds (1000 = 1 secs) current = 0; function next() { if(document.slideform.slide[current 1]) { if(document.all){ document.images.show.style.filter="blendTrans(duration=2)" < > picture if current
document.images.show.style.filter="blendTrans(duration=crossFadeDuration)" document.images.show.filters.blendTrans.Apply() } document.images.show.src = pictureurl[current 1]; setidval('picname',picturename[current 1]); if(document.all){ document.images.show.filters.blendTrans.play() } document.slideform.slide.selectedIndex = current; } else first(); }
function previous() { if(current-1 >= 0) { if(document.all){ document.images.show.style.filter="blendTrans(duration=2)" document.images.show.style.filter="blendTrans(duration=crossFadeDuration)" document.images.show.filters.blendTrans.Apply() } document.images.show.src = pictureurl[current-1]; setidval('picname',picturename[current-1]); if(document.all){ document.images.show.filters.blendTrans.play() }
document.slideform.slide.selectedIndex = --current; } else last();
}
function first() { current = 0; if(document.all){ document.images.show.style.filter="blendTrans(duration=2)" document.images.show.style.filter="blendTrans(duration=crossFadeDuration)" document.images.show.filters.blendTrans.Apply() } document.images.show.src = pictureurl[0]; setidval('picname',picturename[0]); if(document.all){ document.images.show.filters.blendTrans.play() } document.slideform.slide.selectedIndex = 0; }
function last() { current = document.slideform.slide.length-1; if(document.all){ document.images.show.style.filter="blendTrans(duration=2)" document.images.show.style.filter="blendTrans(duration=crossFadeDuration)" document.images.show.filters.blendTrans.Apply() } document.images.show.src = pictureurl[current]; setidval('picname',picturename[current]); if(document.all){ document.images.show.filters.blendTrans.play() } document.slideform.slide.selectedIndex = current; }
function ap(text) { document.slideform.slidebutton.value = (text == "Stop") ? "Start" : "Stop"; rotate(); }
function change() { current = document.slideform.slide.selectedIndex; if(document.all){ document.images.show.style.filter="blendTrans(duration=2)" document.images.show.style.filter="blendTrans(duration=crossFadeDuration)" document.images.show.filters.blendTrans.Apply() } document.images.show.src = pictureurl[current]; setidval('picname',picturename[current]); if(document.all){ document.images.show.filters.blendTrans.play() } }
function rotate() { if (document.slideform.slidebutton.value == "Stop") { current = (current == document.slideform.slide.length-1) ? 0 : current 1; if(document.all){ document.images.show.style.filter="blendTrans(duration=2)" < > picture if current
document.images.show.style.filter="blendTrans(duration=crossFadeDuration)" document.images.show.filters.blendTrans.Apply() } document.images.show.src = pictureurl[current]; setidval('picname',picturename[current]); if(document.all){ document.images.show.filters.blendTrans.play() } document.slideform.slide.selectedIndex = current; window.setTimeout("rotate()", rotate_delay); } } function openpic() { window.open(pictureurl[current]); } // End --> </script>
这个函数是控制js变换的函数
CODE: [Copy to clipboard] <!--主标题--><div id="title" align="center">{$title}</div> <!--文件属性--><div align="center">发布日期:{$adddate} 作者:<a href="{PHPCMS_PATH}member/member.php?username={$username}">{$author}</a> 来源:<a href="{$copyfromurl}" target="_blank">{$copyfromname}</a> 浏览次数:<span id="hits">0</span> <a href="{PHPCMS_PATH}comment/index.php?item=pictureid&itemid={$pictureid}&itemurl={$itemurl}">网友评论<span id="commentnumber1">0</span>条</a> 文字大小:【<a href="javascript :fontZoom(16)">大</a>】【<a href="javascript :fontZoom(14)">中</a>】【<a href="javascript :fontZoom(12)">小</a>】 评分等级:{$stars}</div> <hr align="center" width="740" size="1" noshade />
<div id="{$addtime}1"><a href="{$itemurl}">来源:{$_PHPCMS['sitename']}({$PHP_SITEURL})<br/>作者:{$username}<br/>原文:{$title}({$itemurl})</a></div>
<div id="{$addtime}l">{$content}</div> {if $specialid}<div id="{$addtime}l">相关专题:<a href="{$special[specialurl]}">{$special[specialname]}</a></div>{/if} 这一串和我们以前讲文章页面是一样的,是一些相关的信息
从<form name=slideform >这个地方开始,就是图片的显示区 <span id="picname">{$pictureurls[0][name]}</span> 图片名称 <img src="{$pictureurls[0][url]}" align="center" name="show" id="picture{$id}" />
图片的具体内容 <!--图片名列表--> < > picture if current
<select on change="change();" name="slide"> {loop $pictureurls $id $pic} <option value="{$id}">{$pic[name]}</option> {/loop} </select>
!--控制按钮--> <input />
<input />
<input />
<input />
<input name="button" type=button />
后面的东西就和文章页面是一样的,都是发布评论的内容 |