phpcms 2.2模板主要文件中的关键html代码

文章摘自:http://bbs.phpcms.cn/thread-226-1-1.html

 

说明:

本文整理了phpcms模板主要文件中的关键html代码;
了解其中变量含义请点击http://www.phpcms.cn/data/2005/0704/article_77.htm ;
如果您会手写html,在需要加入个功能板块的<td></td>之间套入本文列举的<table>即可;
如果您不会手写html,用Dreanweaver或者Frontpage做好页面后,切换到代码或者拆分状态在需要加入个功能板块的<td></td>之间套入本文列举的<table>即可;


注意:

1.为了统一,本文列举的表格属性均为<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">如不合适请自行修改;

2.本文列举的<table><tr><td><img><a href>等标签均位定义css样式,如有需要请自行修改;


附:

1.模板中路径的写法:

例:src="{rootpath}/master8/phpcms.htm"表示您安装phpcms的根目录下master8文件夹中的phpcms.htm文件;
如果您是用Dreanweaver或者Frontpage制作页面,作好后切换到代码状态,批量替换路径成phpcms路径的写法即可;
理论上页面中用到的图片可以放在网站中的任何位置,但推荐放在{rootpath}/templates/default(模板名称)/style/default(风格名称)/imgaes/ 目录下;

2.作者信息:

昵称:年华(Andy.L)
Q Q:30773700
主页:www.master8.net(站长吧--为一切站长提供咨讯!)
(转载请保留)

3.如果在使用过程中有任何问题请在此跟贴。







***************************************************
+ header.htm--网页头部/////////////////////////////
***************************************************


<!----------循环输出导航菜单---------->

{loop $mainmenus $mainmenu}| <a href="{$mainmenu[url]}" target="{$mainmenu[target]}" title="{$mainmenu[description]}" >{$mainmenu[catname]}</a>{/loop} 



***************************************************
+ footer.htm--网页底部/////////////////////////////
***************************************************


<!----------版权信息----------->

{$copyright}

<!----------简繁互换js----------->

<Script Language=Javascript Src="{$rootpath}/include/js/Std_StranJF.Js"></Script>



***************************************************
+ index.htm--首页主体部分//////////////////////////
***************************************************


<!----------公告----------->

<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
{loop $announces $announce}
<tr>
  <td><img src="{$rootpath}/templates/{$template}/style/{$style}/images/dot.gif" border="0"><a href="{$rootpath}/data/{$announce[addtime]}/announcement_{$announce[announceid]}.htm" target="_blank" title="{$announce[title]}">{$announce[stitle]}</a></td>
</tr>
{/loop}
</table>

<!------插入搜索iframe----->

<iframe id="search" border="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" framespacing="0" frameborder="0" scrolling="no" width="500" height="25" src="{$rootpath}/data/iframe/search_iframe.htm"></iframe>

<!----------推荐文章----------->

<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
{loop $elites $elite}
<tr>
  <td><img src="{$rootpath}/templates/{$template}/style/{$style}/images/article_{if $elite[ontop]}ontop{elseif $elite[elite]}elite{else}common{/if}.gif" alt="{if $elite[ontop]}{lang hotarticle}{elseif $elite[elite]}{lang commendarticle}{else}{lang hotarticle}{/if}"> {$elite[includepic]}</font> <a href="{$rootpath}/data/{$elite[addtime]}/article_{$elite[articleid]}.htm" title="{$elite[title]} {$elite[adddate]}" target="_blank">{$elite[fonttype][0]}<font color="{$elite[titlefontcolor]}">{$elite[stitle]}</font>{$elite[fonttype][1]}</a>{if $elite[showcommentlink]}&nbsp;<a href="comment.php?articleid={$elite[articleid]}" title="查看和发表评论" target="_blank"><span class="color_red">评</span></a>{/if}</td>
</tr>
{/loop}
</table>

<!----------热点文章----------->

<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
{loop $hots $hot}
<tr>
  <td><img src="{$rootpath}/templates/{$template}/style/{$style}/images/article_{if $hot[ontop]}ontop{elseif $hot[elite]}elite{else}common{/if}.gif" alt="{if $hot[ontop]}{lang hotarticle}{elseif $hot[elite]}{lang commendarticle}{else}{lang hotarticle}{/if}"> {$hot[includepic]}</font> <a href="{$rootpath}/data/{$hot[addtime]}/article_{$hot[articleid]}.htm" title="{$hot[title]} {$hot[adddate]}" target="_blank">{$hot[fonttype][0]}<font color="{$hot[titlefontcolor]}">{$hot[stitle]}</font>{$hot[fonttype][1]}</a>{if $hot[showcommentlink]}&nbsp;<a href="comment.php?articleid={$hot[articleid]}" title="查看和发表评论" target="_blank"><span class="color_red">评</span></a>{/if}</td>
</tr>
{/loop}
</table>

<!------最新专题图片--------->

{if $special[specialpic]}
<a href="{$rootpath}/data/{$special[addtime]}/special_{$special[specialid]}.htm" target="_blank">
<img src="{$special[specialpic]}" width="100" height="100" border="0">
{else}
<img src="{$rootpath}/images/nopic.gif" width="100" height="100" border="0">
{/if}

<!------最新专题文章--------->

<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
{loop $specialarticles $specialarticle} 
<tr>
  <td>·<a href="{$rootpath}/data/{$specialarticle[addtime]}/article_{$specialarticle[articleid]}.htm" target="_blank">{$specialarticle[title]}</a></td>
</tr>
{/loop}
</table>

<!------专题导航-------->

<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
{loop $specials $special}
<tr>
  <td>·<a href="{$rootpath}/data/{$special[addtime]}/special_{$special[specialid]}.htm" target="_blank">{$special[specialname]}</a></td>
</tr>
{/loop}
</table>

<!------最新图片文章-------->

<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
<tr>
{loop $picarticles $picarticle}
  <td align="center"><a href="{$rootpath}/data/{$picarticle[addtime]}/article_{$picarticle[articleid]}.htm" target="_blank" title="{$picarticle[title]}"><img src="{$picarticle[defaultpicurl]}" width="150" height="150" border="0" class="img"><br><br>{$picarticle[stitle]}</a></td>
{/loop} 
</tr>
</table>

<!------推荐logo链接-------->

<table width="100%" border="0" cellspacing="5" cellpadding="0">
{loop $elitesites $elitesite}
  <tr align="center">
    <td><a href="{$elitesite[url]}" target="_blank"><img src="{$elitesite[logo]}" width="88" height="31" border="0" alt="{$elitesite[name]}:{$elitesite[introduce]}"></a></td>
  </tr>
{/loop}
</table>

<!------logo链接-------->

<div id=rolllink style=overflow:hidden;height:180;100><div id=rolllink1>
<table width="100%" cellSpacing="5">
{loop $logosites $logosite}
   <tr align="center"><td><a href="{$logosite[url]}" target="_blank"><img src="{$logosite[logo]}" width="88" height="31" border="0" alt="{$logosite[name]}:{$logosite[introduce]}"></a></td></tr>
{/loop}
</table>
</div>
<div id="rolllink2"></div>
</div>
<script>
var rollspeed=30
rolllink2.innerHTML=rolllink1.innerHTML
function Marquee(){
if(rolllink2.offsetTop-rolllink.scrollTop<=0)
rolllink.scrollTop-=rolllink1.offsetHeight
else{
rolllink.scrollTop++
}
}
var MyMar=setInterval(Marquee,rollspeed)
rolllink.onmouseover=function() {
  clearInterval(MyMar)
}
rolllink.onmouseout=function() {
  MyMar=setInterval(Marquee,rollspeed)
}
</script>

<!-----文字链接-------->

<select name="FriendSite" onchange="if(this.options[this.selectedIndex].value!=''){window.open(this.options[this.selectedIndex].value,'_blank');}">
<option value="">{lang friendsitetext}</option>
{loop $textsites $textsite}
<option value="{$textsite[url]}">{$textsite[name]}</option>
{/loop}
</select>

<!------栏  目-------->

<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
{loop $specials $special}
<tr>
  <!--cat left--><td>
{loop $cats1 $cat}
<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
<tr>
   <td width="80%">{$cat[catname]}</td>
   <td width="20%"><a href="{$rootpath}/data/{$cat[catdir]}/" target="_blank">more</a></td>
  </tr>
</table>

<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
{loop $cat[article] $article}
<tr>
   <td><img src="{$rootpath}/templates/{$template}/style/{$style}/images/article_{if $article[ontop]}ontop{elseif $article[elite]}elite{else}common{/if}.gif" alt="{if $article[ontop]}{lang hotarticle}{elseif $article[elite]}{lang commendarticle}{else}{lang hotarticle}{/if}"> {$article[includepic]}</font> <a href="{$rootpath}/data/{$article[addtime]}/article_{$article[articleid]}.htm" title="{$article[title]} {$article[adddate]}" target="_blank">{$article[fonttype][0]}<font color="{$article[titlefontcolor]}">{$article[stitle]}</font>{$article[fonttype][1]}</a>{if $article[showcommentlink]}<a href="comment.php?articleid={$article[articleid]}" title="查看和发表评论" target="_blank"><span class="color_red">评</span></a>{/if}</td>
</tr>
{/loop}
</table>
{/loop}
</td><!--cat left-->

<!--cat right--><td>
{loop $cats2 $cat}
<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
<tr>
   <td width="80%">{$cat[catname]}</td>
   <td width="20%"><a href="{$rootpath}/data/{$cat[catdir]}/" target="_blank">more</a></td>
  </tr>
</table>

<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
{loop $cat[article] $article}
<tr>
   <td><img src="{$rootpath}/templates/{$template}/style/{$style}/images/article_{if $article[ontop]}ontop{elseif $article[elite]}elite{else}common{/if}.gif" alt="{if $article[ontop]}{lang hotarticle}{elseif $article[elite]}{lang commendarticle}{else}{lang hotarticle}{/if}"> {$article[includepic]}</font> <a href="{$rootpath}/data/{$article[addtime]}/article_{$article[articleid]}.htm" title="{$article[title]} {$article[adddate]}" target="_blank">{$article[fonttype][0]}<font color="{$article[titlefontcolor]}">{$article[stitle]}</font>{$article[fonttype][1]}</a>{if $article[showcommentlink]}<a href="comment.php?articleid={$article[articleid]}" title="查看和发表评论" target="_blank"><span class="color_red">评</span></a>{/if}</td>
</tr>
{/loop}
</table>
{/loop}
</td><!--cat right-->
</tr>
{/loop}
</table>




***************************************************
+ category.htm--含有子栏目的栏目页/////////////////
***************************************************


<!--------------子栏目导航-------------->

<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
{loop $childcats $childcat}
  <tr>
    <td><a href="{$childcat[url]}" target="{$childcat[target]}">{$childcat[catname]}</a></td>
  </tr>
{/loop}
</table>

<!--------------位置导航-------------->

{lang thisposition}:
{loop $catlists $key $catlist}
{if $key}<a href="{$rootpath}/data/{$catlist[catdir]}" >{$catlist[catname]}</a>>>{else}<a href="{$rootpath}/" >{$catlist[catname]}</a>>>{/if}
{/loop}
<a href="{$rootpath}/data/{$cat[catdir]}" >{$cat[catname]}</a>

<!--------------栏目循环-------------->

{loop $articlelist $category}
<!--顶部-->
<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
  <tr>
   <td width="90%">&nbsp;{$category[catname]}</td>
   <td width="10%"><a href="{$rootpath}/data/{$category[catdir]}/">more</a></td>
  </tr>
</table>

<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
  <tr>
   <td align="center" valign="top"><!--图片-->
    {if $category[picarticle]}
     <a href="{$rootpath}/data/{$category[picarticle][addtime]}/article_{$category[picarticle][articleid]}.htm" target="_blank"><img src="{$category[picarticle][defaultpicurl]}" width="130" height="130" border="0" class="img" alt="{$category[picarticle][title]}">
     <br>{$category[picarticle][title]}</a>
     {else}
     <img src="{$rootpath}/images/nopic.gif" width="130" height="130" border="0" class="img"><br>
    {/if}
    </td>
    <td valign="top"><!--标题-->
     <table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
     {loop $category[article] $article}
       <tr>
          <td width="90%"><img src="{$rootpath}/templates/{$template}/style/{$style}/images/article_{if $article[ontop]}ontop{elseif $article[elite]}elite{else}common{/if}.gif" alt="{if $article[ontop]}{lang ontoparticle}{elseif $article[elite]}{lang commendarticle}{else}{lang commonarticle}{/if}"> {$article[includepic]}</font> <a href="{$rootpath}/data/{$article[addtime]}/article_{$article[articleid]}.htm" title="{$article[title]}" target="_blank">{$article[fonttype][0]}<font color="{$article[titlefontcolor]}">{$article[title]}</font>{$article[fonttype][1]}</a>{if $article[showcommentlink]}&nbsp;<a href="{$rootpath}/comment.php?articleid={$article[articleid]}" title="{lang viewandcomment}" target="_blank"><span class="color_red">{lang shortcomment}</font></a>{/if}</td>
          <td width="10%">{$article[adddate]}</td>
       </tr>
       {/loop}
     </table>
        </td>
  </tr>
</table>
{/loop}




***************************************************
+ category_list.htm--无子栏目的栏目页//////////////
***************************************************


<!--------------栏目名称-------------->

<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
  <tr>
    <td>&nbsp;{$cat[catname]}</td>
    </tr>
</table>

        
<!--------------文章列表-------------->

<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
{loop $articles $article}
  <tr>
    <td width="80%"><img src="{$rootpath}/templates/{$template}/style/{$style}/images/article_{if $article[ontop]}ontop{elseif $article[elite]}elite{else}common{/if}.gif" alt="{if $article[ontop]}{lang ontoparticle}{elseif $article[elite]}{lang commendarticle}{else}{lang commonarticle}{/if}"> {$article[includepic]}</font> <a href="{$rootpath}/data/{$article[addtime]}/article_{$article[articleid]}.htm" title="{$article[title]}" target="_blank">{$article[fonttype][0]}<font color="{$article[titlefontcolor]}">{$article[title]}</font>{$article[fonttype][1]}</a>{if $article[showcommentlink]}&nbsp;<a href="{$rootpath}/comment.php?articleid={$article[articleid]}" title="{lang viewandcomment}" target="_blank"><span class="color_red">{lang shortcomment}</span></a>{/if}</td>
    <td width="20%" align="center" >{$article[adddate]}</td>
  </tr>
{/loop}
</table>


<!--------------分页函数-------------->

<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
  <tr>
    <td align="center">{$pages}</td>
    </tr>
</table>



***************************************************
+ special.htm--专题首页////////////////////////////
***************************************************


<!----------最新推荐专题------------>

<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
{loop $newelites $newelite}
  <tr>
    <td align="center"><a href="{$rootpath}/data/{$newelite[addtime]}/special_{$newelite[specialid]}.htm"><img src="{if $newelite[specialpic]}{$newelite[specialpic]}{else}{$rootpath}/images/nopic.gif{/if}" width="180" height="180" border="0" class="img" alt="{$newelite[specialname]}"><br><br>{$newelite[specialname]}</a></td>
  </tr>
{/loop}
</table>


<!---------往日推荐专题-------------->

<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
{loop $oldelites $oldelite}
  <tr>
    <td align="center"><a href="{$rootpath}/data/{$oldelite[addtime]}/special_{$oldelite[specialid]}.htm"><img src="{if $oldelite[specialpic]}{$oldelite[specialpic]}{else}{$rootpath}/images/nopic.gif{/if}" width="180" height="180" border="0" class="img" alt="{$oldelite[specialname]}"><br><br>{$oldelite[specialname]}</a></td>
  </tr>
{/loop}
</table>

<!---------专题列表-------------->

<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
{loop $speciallists $speciallist}
  <tr>
   <td width="85%">·<a href="{$rootpath}/data/{$speciallist[addtime]}/special_{$speciallist[specialid]}.htm">{$speciallist[specialname]}</a></li></td>
   <td width="15%">{$speciallist[adddate]}</td>
  </tr>
{/loop}
</table>



***************************************************
+ special_detail.htm--专题内容页///////////////////
***************************************************



<!-----------最新专题-------------->

<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
{loop $newspecials $newspecial}
  <tr>
    <td>·<a href="{$rootpath}/data/{$newspecial[addtime]}/special_{$newspecial[specialid]}.htm">{$newspecial[specialname]}</a></td>
  </tr>
{/loop}
</table>

<!------------专题图片---------->

<img src="{if $special[specialpic]}{$special[specialpic]}{else}{$rootpath}/images/nopic.gif{/if}" width="180" height="180">

<!------------专题名称---------->

{$special[specialname]}

<!------------专题描述---------->

{$special[discription]}


<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
{loop $elites $elite} 
   <tr>
     <td  width="80%">·<a href="{$rootpath}/data/{$elite[addtime]}/article_{$elite[articleid]}.htm"  target="_blank">{$elite[title]}</a></td>
         <td width="20%">{$elite[adddate]></td>
  </tr>
{/loop}
</table>

<!------------专题图片文章---------->

<table width="100%"  border="0" align="center" cellpadding="2" cellspacing="2">
  <tr>
{loop $picarticles $picarticle}
    <td height="130" height="130" align="center"><a href="{$rootpath}/data/{$picarticle[addtime]}/article_{$picarticle[articleid]}.htm" target="_blank"><img src="{$picarticle[defaultpicurl]}" width="120" height="120" border="0" alt="{$picarticle[title]}"><br>{$picarticle[title]}</a></td>
  </tr>
{/loop}        
</table>

<!------------专题文章列表---------->

<table width="100%"  border="0" cellspacing="2" cellpadding="2" align="center">
{loop $articles $article}
  <tr>
    <td  width="85%">·<a href="{$rootpath}/data/{$article[addtime]}/article_{$article[articleid]}.htm"  target="_blank">{$article[title]}</a></td>
    <td  width="15%">{$article[adddate]}</td>
  </tr>
{/loop}
</table>

原文地址:https://www.cnblogs.com/nidakun/p/2729725.html