图片频道的模板制作

王朝网站推广·作者佚名  2011-12-03
窄屏简体版  字體: |||超大  

菠萝教你做模板之五-图片频道的模板制作

前面我们已经讲过了文章、下载频道的模板制作,今天讲完图片频道之后,剩下的就是专题的制作,虽然每个频道都有专题,但是制作方法都是一样的,我们讲集中讲解。好,闲话不说,开始讲课。

打开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]}' alt='{$picture[alt]}' width='{$imgwidth}' height='{$imgheight}'> 这里面就是你在发布图片时候选的 缩略图的大小

<a href='{$picture[url]}' target='_blank' title='{$picture[alt]}'[/color]>{$picture[title]}</a>

这几个分别是图片的地址 图片的提示 图片的标题

{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]}" title="{$picture[alt]}" target="{$picture[target]}" class="tag_title_link{$picture[fonttype]}">{$picture[title]}</a> 图片标题及路径

{if $showhits}({$picture[hits]}){/if} 如果允许显示点击数,则显示点击数

{if $showauthor}[作者:{$picture[author]}]{/if} 显示作者

{if $datetype}[<span class="tag_date">{$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)"

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

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:

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航