首页 > 代码库 > phpcms的网页替换

phpcms的网页替换

//替换首页header:首页不用替换
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
//替换标题
<title>{if isset($SEO[‘title‘]) && !empty($SEO[‘title‘])}{$SEO[‘title‘]}{/if}{$SEO[‘site_title‘]}</title>
<meta name="keywords" content="{$SEO[‘keyword‘]}">
<meta name="description" content="{$SEO[‘description‘]}">

<link rel="SHORTCUT ICON" href="http://tianqi.itnba.com/tianqizhuye/tianqi/logo.ico"/>
//替换引用的JS CSS:必须在js和css文件夹里面必须用"{JS_PATH}dist/和"{CSS_PATH}dist/最为路径
<script src="http://www.mamicode.com/{JS_PATH}dist/js/jquery-1.11.2.min.js"></script>
<script src="http://www.mamicode.com/{JS_PATH}dist/js/bootstrap.min.js"></script>
<link href="http://www.mamicode.com/{JS_PATH}dist/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="http://www.mamicode.com/{JS_PATH}css/index.css" rel="stylesheet" type="text/css" />
 {pc:content action="category" catid="0" num="5" siteid="$siteid" order="listorder DESC"}               
                {loop $data $r}
                <li><a href="http://www.mamicode.com/{$r[url]}">//替换链接{$r[catname]}//替换主菜单</a></li>
                {/loop}
                </ul>
         {/pc}
//首页大图轮播:ASC和DESC是排序方式 num是第几个图片 ({$val[‘thumb‘]}是替换的图片路径)
{pc:content action="lists" catid="15" order="id ASC" num="4"}
        {loop $data $key $val}
         {if $key==1}//条件
          <div class="item active">
                 <img class="img_lunbo" src="http://www.mamicode.com/{$val[‘thumb‘]}"alt="First slide">
             </div>
            {else}
             <div class="item">
                 <img class="img_lunbo" src="http://www.mamicode.com/{$val[‘thumb‘]}" alt="First slide">
                </div>
            {/if}
        {/loop}
        {/pc}

//替换主页面的子栏目:{$CATEGORYS[12][catname]}替换的一级栏目的名称;{$CATEGORYS[12][url]}替换一级栏目的栏目模板;{$val[‘thumb‘]}是替换子栏目的图片路径;{$val[‘title‘]}是替换子栏目的标题;{$val[‘description‘]}是替换子栏目的摘要
  {template "content","header"}<!--引入头部文件-->
   <a name="xwdt"></a>
     <div class="row list_cy_row">
   
     <div class="col-sm-11">
         <img src="http://www.mamicode.com/{IMG_PATH}tianqi/logotouming.png" width="25" height="25" />
            &nbsp;{$CATEGORYS[12][catname]}
        </div>
        <a href="http://www.mamicode.com/{$CATEGORYS[12][url]}">
        <div class="col-sm-1" id="ry_more">
         more>>
        </div>
        </a>
    </div>
   
    <div class="row" style=" padding-top:15px">
         {pc:content action="lists" catid="12" order="id DESC" num="6"}
        {loop $data $key $val}
        <div class="col-sm-6 col-md-3">
             <div class="thumbnail">
       
               <img src="http://www.mamicode.com/{$val[‘thumb‘]}" alt="新闻1" class="xw_list_img" />
                <div class="caption">
                    <h4>{$val[‘title‘]}</h4>
                    <p>{$val[‘description‘]}</p>
                   
                </div>
              </div>
        </div>
       
              {/loop}
        {/pc}

  {template "content","footer"}<!--引入尾部文件-->

//替换主菜单里面的子菜单:必须用category和list开头的html list是内容 category是子栏目的html
  {template "content","header"}<!--引入头部文件-->
   <!--菜单结束-->
  
   <!--成员页图开始-->
   <div class="row">
       <img src="http://www.mamicode.com/{$CAT[‘image‘]}" class="img-responsive img_head" />
   </div>
   <!--成员页图结束-->
  
   <!--成员列表开始-->
   <a name="n0904"></a>
 
   <div class="row list_cy_row">
     <div class="col-sm-12">
         <img src="http://www.mamicode.com/{IMG_PATH}tianqi/logotouming.png" width="25" height="25" />
            &nbsp;{$CATEGORYS[33][catname]}
        </div>
    </div>
    
   <div class="row" style=" padding-top:15px">
    {pc:content action="lists" catid="33" order="id ASC" num="18"}
        {loop $data $key $val}
        <div class="col-sm-3 col-md-2">
             <div class="thumbnail">
                <a href="http://www.mamicode.com/{$val[‘url‘]}">
                <img class="cy_tp_list" src="http://www.mamicode.com/{$val[‘thumb‘]}" ></a>
                <div class="caption">
                    <h4>{$val[‘title‘]}</h4>
                    <p>{$val[‘description‘]}</p>
                </div>
             </div>
        </div>
         {/loop}
        {/pc}
       
    </div>
//替换关于我们:替换是替换摘要({$val[‘content‘]})在pc标签里面必须加moreinfo="1"  锚点里面前面("n{$val[id]})必须价格n那个n代表数字"n{$val[id]} pc标签里面的(catid="$catid")是主栏目的catid
  <!--公司简介开始-->
  {pc:content action="lists" catid="$catid" order="id ASC" num="18" moreinfo="1"}
        {loop $data $key $val}
   <!--制作人员开始-->
   <a name="n{$val[id]}"></a>
   <div class="row jj_tou">
     <div class="col-sm-12">
         <img src="http://www.mamicode.com/{$val[thumb]}" class="img-responsive jj_pic" />
           <span class="jj_name">{$val[title]}</span>
        </div>
   </div>
   <div class="row">
   
     <div class="col-sm-12 jj_nr">
         
            <p>{$val[‘content‘]}</p>
        </div>
      
   </div>
   <hr class="split_info" />
  
    {/loop}
     {/pc}

//替换内容页:{$title}标题 {$copyfrom}来源 {$inputtime}时间
<div class="col-sm-3" style="width:30%">
      {pc:content action="relation" relation="$relation" catid="$catid" num="5" keywords="$rs[keywords]"}
                     {loop $data $r}
                     {if $r[‘id‘]==$id}//判断如果id=id 后面加个active
                      <a href="http://www.mamicode.com/{$r[‘url‘]}" class="list-group-item active" >{$r[‘title‘]}</a>
                     {else}                   
                     <a href="http://www.mamicode.com/{$r[‘url‘]}" class="list-group-item" >{$r[‘title‘]}</a>
                     {/if}
                     {/loop}
       {/pc}                             
    
      </div>
 
      
      <div class="col-sm-7">
       <div>
       <center><h3>{$title}</h3></center>
      <center> <h5>作者:{$copyfrom} 发布时间:{$inputtime}</h5></center>
   
       {$content}
       </div>
 
        <div>
        <p class="f14">
                <strong>上一篇:</strong><a href="http://www.mamicode.com/{$previous_page[url]}">{$previous_page[title]}</a><br />
                <strong>下一篇:</strong><a href="http://www.mamicode.com/{$next_page[url]}">{$next_page[title]}</a>
         </p>
            <!--上一篇下一篇结束-->
             <!--投票开始-->
            <div class="bk15"></div>
            {if module_exists(‘mood‘)}<script type="text/javascript" src="http://www.mamicode.com/{APP_PATH}index.php?m=mood&c=index&a=init&id={id_encode($catid,$id,$siteid)}"></script>{/if}
        </div>
            <!--投票结束-->
         <!--分享开始-->
            <div class="Article-Tool">
          分享到:
    <img src="http://v.t.qq.com/share/images/s/weiboicon16.png" style="padding-bottom:3px;" onclick="postToWb();" class="cu" title="分享到腾讯微博"/>
    <script type="text/javascript">
 function postToWb(){
  var _t = encodeURI(document.title);
  var _url = encodeURIComponent(document.location);
  var _appkey = encodeURI("cba3558104094dbaa4148d8caa436a0b");
  var _pic = encodeURI(‘{$thumb}‘);
  var _site = ‘‘;
  var _u = ‘http://v.t.qq.com/share/share.php?url=‘+_url+‘&appkey=‘+_appkey+‘&site=‘+_site+‘&pic=‘+_pic+‘&title=‘+_t;
  window.open( _u,‘‘, ‘width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no‘ );
 }
</script>
        <!--  <script type="text/javascript">document.write(‘<a href="http://v.t.sina.com.cn/share/share.php?url=‘+encodeURIComponent(location.href)+‘&appkey=3172366919&title=‘+encodeURIComponent(‘{new_addslashes($title)}‘)+‘" title="分享到新浪微博" class="t1" target="_blank">&nbsp;‘+‘<img src="http://www.mamicode.com/{IMG_PATH}/新浪微博图标.png" width="16" height="19" style="padding-bottom:3px;" onclick="postToWb();" class="cu" title="分享到新浪微博"/>‘+‘</a>‘);</script>
         
    <script type="text/javascript">document.write(‘<a href="http://www.douban.com/recommend/?url=‘+encodeURIComponent(location.href)+‘&title=‘+encodeURIComponent(‘{new_addslashes($title)}‘)+‘" title="分享到豆瓣" class="t2" target="_blank">&nbsp;‘+‘<img src="http://www.mamicode.com/{IMG_PATH}/douban.jpg" width="16" height="19" style="padding-bottom:3px;" onclick="postToWb();" class="cu" title="分享到豆瓣"/>‘+‘</a>‘);</script>
         
    <script type="text/javascript">document.write(‘<a href="http://share.renren.com/share/buttonshare.do?link=‘+encodeURIComponent(location.href)+‘&title=‘+encodeURIComponent(‘{new_addslashes($title)}‘)+‘" title="分享到人人" class="t3" target="_blank">&nbsp;‘+‘<img src="http://www.mamicode.com/{IMG_PATH}/renren.jpg" width="16" height="19" style="padding-bottom:3px;" onclick="postToWb();" class="cu" title="分享到人人"/>‘+‘</a>‘);</script>
         
    <script type="text/javascript">document.write(‘<a href="http://www.kaixin001.com/repaste/share.php?rtitle=‘+encodeURIComponent(‘{new_addslashes($title)}‘)+‘&rurl=‘+encodeURIComponent(location.href)+‘&rcontent=" title="分享到开心网" class="t4" target="_blank">&nbsp;‘+‘<img src="http://www.mamicode.com/{IMG_PATH}/kaixin.png" width="16" height="19" style="padding-bottom:3px;" onclick="postToWb();" class="cu" title="分享到开心网"/>‘+‘</a>‘);</script>
         
    <script type="text/javascript">document.write(‘<a href="http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=‘+encodeURIComponent(location.href)+‘" title="分享到QQ空间" class="t5" target="_blank">&nbsp;‘+‘<img src="http://www.mamicode.com/{IMG_PATH}/QQkongjian.png" width="16" height="19" style="padding-bottom:3px;" onclick="postToWb();" class="cu" title="分享到QQ空间"/>‘+‘</a>‘);</script>
      -->
   <span id=‘favorite‘>
  <a href="javascript:;" onclick="add_favorite(‘{addslashes($title)}‘);" class="t6">收藏</a>
   </span>
   </div>
      <!--分享结束-->
         <!--评论开始-->
      <div class="bk10"></div>
      {if $allow_comment && module_exists(‘comment‘)}
      <iframe src="http://www.mamicode.com/{APP_PATH}index.php?m=comment&c=index&a=init&commentid={id_encode("content_$catid",$id,$siteid)}&iframe=1" width="100%" height="100%" id="comment_iframe" frameborder="0" scrolling="no"></iframe>
      <div class="box">
          <h5>评论排行</h5>
     {pc:comment action="bang" siteid="$siteid" cache="3600"}
             <ul class="content list blue f14 row-2">
    {loop $data $r}
                 <li>·<a href="http://www.mamicode.com/{$r[url]}" target="_blank">{str_cut($r[title], 40)}</a><span>({$r[total]})</span></li>
     {/loop}
                </ul>
    {/pc}
        </div>
        {/if}
       <!--评论结束-->
 
        <!--显示内容下面的信息结束-->
    </div>
   

 

//替换页脚fotter:
<!--页脚开始-->
    <div class="row">
     <div class="col-xs-12 yejiao">
  //替换引用的img:必须在image文件夹里面必须用"{IMG_PATH}**/作为路径
         <div><img src="http://www.mamicode.com/{IMG_PATH}tianqi/logotouming.png" width="20" height="20" /> &nbsp;power by &copy;汉企天启网络</div>
            <div>地址:山东省淄博市张店区共青团西路23号富丽商城四楼</div>
            <div>联系方式:2173028</div>
        </div>
    </div>
 <!--页脚结束-->

phpcms的网页替换