ssi(服务器端包含)和js(客户端)

解决方案 »

  1.   

    具体如何包含
    在静态页面中不能用include 
      

  2.   

    用window.write 输出
    我是把头尾用文件读进去以后然后再生成静态页面
    然而这样的话万一头部文件改动也就是说所有的生成的静态都需要调整了<head>
    <meta http-equiv="Content-Type" content="text/html; charset=??????">
    <title>{title}</title>
    </head><body>
    {head}<!--头部-->
    <table width="500" border="1" align="center">
      <tr>
        <td align="center"><strong>{title}</strong></td>
      </tr>
      <tr>
        <td>{content}</td>
      </tr>
      <tr>
        <td align="right">{datetime}</td>
      </tr>
    </table>
    {end}}<!--尾部(include("end.htm"))-->
    </html>
      

  3.   

    $fp          = fopen ("index.html","r");
      $fileinfo= fread ($fp,filesize ("index.html"));
     $title="静态页面的生成";
     $info="页面的内容";
     $datetime=date("Y-m-d H:i:s");   $fp1          = fopen ("head.html","r");//生成头部
       $head= fread ($fp1,filesize ("head.html"));
       fclose($fp1);
       $fp2          = fopen ("end.html","r");
       $end= fread ($fp2,filesize ("end.html"));//生成尾部
        fclose($fp2);  $content = str_replace ("{head}",$head,$fileinfo);//输出头部
      $content = str_replace ("{head}",$end,$fileinfo);//输出尾部  $content = str_replace ("{title}",$title,$fileinfo);
      $content = str_replace ("{content}",$info,$fileinfo);
      $content = str_replace ("{datetime}",$datetime,$fileinfo);
       $filename = "test/test.html";
      $handle    = fopen ($filename,"w"); //打开文件指针,创建文件
      /*
     检查文件是否被创建且可写
      */
      if (!is_writable ($filename)){ 
         die ("文件:".$filename."不可写,请检查其属性后重试!");
      }
      if (!fwrite ($handle,$content)){  //将信息写入文件
         die ("生成文件".$filename."失败!");
      } 
      fclose ($handle); //关闭指针
      
      die ("创建文件".$filename."成功!");fclose($fp)
      

  4.   

    如果部头尾做相应的修改 而这种方试就不可取了静态页面如果去包含一个页面  (就像include require 一样谢谢)
      

  5.   

    iframe 属性连接一个页面就可以了
      

  6.   

    js 和 iframe 都可以实现,不过不利于搜索引擎收录。可以考虑用 shtml ,如:<!--#include virtual="/includes/header.html" -->去查查shtml ssi 相关的说明。
      

  7.   

    shtml吧,或者js都可以 
      

  8.   

    建议shtml 
    js的话搜索引荐会不找这些链接的!