Top >  ネット関係 >  Web制作 >  Movable Type 3.34 php化

Movable Type 3.34 php化

グーグルで調べているとすばらしいページにぶち当たった。
Movable Type を始める前に設定しておきたい 10 の項目
おお、俺、php化やってみたい!
てなわけで、一通り設定する。

ん!?
あ、あれ~~~


shop.gif
エントリーしているのに表示されない…。


ftp.gif
あっ、index.hmtlがいつのまにかできている!?


ftp2.gif
ひとまずリネームだ!!!


shop2.gif
表示された


ルートにindex.htmlがあるとindex.phpより優先されて表示される。
必ずindex.htmlがないことを確認しましょう。
index.htmlも構築している場合は、FTPで削除しましょう。

こんなんでハマルの俺ぐらいだろうけど…orz

テンプレート(index.php,archives.php)の先頭に下記を追加した。

<?php
$ts = getlastmod();
doConditionalGet($ts);
 
function doConditionalGet($timestamp) {
  // A PHP implementation of conditional get, see 
  //   http://fishbowl.pastiche.org/archives/001132.html
  $last_modified = gmdate('D, d M Y H:i:s T', $timestamp);
  $etag = '"'.md5($last_modified).'"';
  // Send the headers
  header("Last-Modified: $last_modified");
  header("ETag: $etag");
  // See if the client has provided the required headers
  $if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ?
    stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE']) :
    false;
  $if_none_match = isset($_SERVER['HTTP_IF_NONE_MATCH']) ?
    stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : 
    false;
  if (!$if_modified_since && !$if_none_match) {
    return;
  }
  // At least one of the headers is there - check them
  if ($if_none_match && $if_none_match != $etag) {
    return; // etag is there but doesn't match
  }
  if ($if_modified_since && $if_modified_since != $last_modified) {
    return; // if-modified-since is there but doesn't match
  }
  // Nothing has changed since their last request - serve a 304 and exit
  header('HTTP/1.1 304 Not Modified');
  exit;
}
?>

 <  前の記事 pingoo  |  トップページ  |  次の記事 Movable Type・アクセス解析  > 

コメントを投稿

(いままで、ここでコメントしたことがないときは、コメントを表示する前にこのブログのオーナーの承認が必要になることがあります。承認されるまではコメントは表示されません。そのときはしばらく待ってください。)

         


このページについて

このページは「uraura」の記事のひとつです。

他にも多くの記事があります。トップページサイトマップもご覧ください。

スポンサードリンク
更新履歴
アフィリエイター募集中!