首页 期权学习期权知识正文

phpcms制作图片频道模板的教程

xiaojiucai 期权知识 2020-08-18 384 0

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

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

 #p# 关键字描述:制作 模板 频道 图片 " < > 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)"

 #p# 关键字描述:制作 模板 频道 图片 " < > 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 class="par" align="center">发布日期:{$adddate}&nbsp;&nbsp;作者:<a href="{PHPCMS_PATH}member/member.php?username={$username}" class="member_url">{$author}</a>&nbsp;&nbsp;来源:<a href="{$copyfromurl}" target="_blank">{$copyfromname}</a>&nbsp;&nbsp;浏览次数:<span id="hits">0</span>&nbsp;&nbsp;<a href="{PHPCMS_PATH}comment/index.php?item=pictureid&itemid={$pictureid}&itemurl={$itemurl}" class="commenturl">网友评论<span id="commentnumber1">0</span>条</a>&nbsp;&nbsp;文字大小:【<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 style="color:#cccccc;" />

<div class="content_text" id="{$addtime}1"><a href="{$itemurl}">来源:{$_PHPCMS['sitename']}({$PHP_SITEURL})<br/>作者:{$username}<br/>原文:{$title}({$itemurl})</a></div>

<div class="content_text" id="{$addtime}l">{$content}</div>

{if $specialid}<div class="content_text" id="{$addtime}l">相关专题:<a href="{$special[specialurl]}" class="specialurl">{$special[specialname]}</a></div>{/if} 这一串和我们以前讲文章页面是一样的,是一些相关的信息

从<form name=slideform >这个地方开始,就是图片的显示区

<span id="picname" style="font-weight:bold;font-size:14px;">{$pictureurls[0][name]}</span> 

图片名称

<img src="{$pictureurls[0][url]}" align="center" name="show" id="picture{$id}" alt="{$pictureurls[0][name]}" border="0" style="cursor:hand;" on click="openpic()" on load="javascript :setpicWH(picture{$id},720,1000)">

图片的具体内容

<!--图片名列表-->

 #p# 关键字描述:制作 模板 频道 图片 " < > picture if current

<select on change="change();" name="slide">

{loop $pictureurls $id $pic}

<option value="{$id}">{$pic[name]}</option>

{/loop}

</select>

!--控制按钮-->

<input title=Beginning on click=first(); type=button value=" |<< " class="btn">

<input title=Previous on click=previous(); type=button value=" << " class="btn">

<input title=AutoPlay on click=ap(this.value); type=button value=Start name=slidebutton class="btn">

<input title=Next on click=next(); type=button value=" >> " class="btn">

<input name="button" type=button title=End on Click=last(); value=" >>| " class="btn">

后面的东西就和文章页面是一样的,都是发布评论的内容

原文链接:https://www.qiquanji.com/post/8275.html

本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。

微信扫码关注

更新实时通知

版权声明

本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。

评论