Skip to content

Instantly share code, notes, and snippets.

@eiel
Created October 7, 2014 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eiel/ed23fb0bf5a9787ab1c5 to your computer and use it in GitHub Desktop.
Save eiel/ed23fb0bf5a9787ab1c5 to your computer and use it in GitHub Desktop.
a-blog CMSでファイルの更新を検知してクエリパラメータを変更する。固定値がはいりまくりのバージョン
<?php
require_once ACMS_LIB_DIR.'GET.php';
class ACMS_GET_File_Mtime extends ACMS_GET
{
function get()
{
$Tpl = new Template($this->tpl);
$labels = $Tpl->_varIdLabel;
$dir = "THEME_DIR";
$root = "ROOT_DIR";
$values = array();
foreach ($labels as $label) {
$path = $root.$dir.$label;
$date = date('YmdHis', filemtime($path));
$values[$label] = "?".$date;
}
$Tpl->add(null, $values);
return $Tpl->get();
}
}
@eiel
Copy link
Author

eiel commented Oct 7, 2014

利用例

php/ACMS/GET/File に配置する

<!-- BEGIN_MODULE File_Mtime -->
<link rel="stylesheet" href="css/common.css{css/common.css}">
<link rel="stylesheet" href="css/sp.css{css/sp.css}">
<link rel="stylesheet" href="css/tab.css{css/tab.css}">
<link rel="stylesheet" href="css/pc.css{css/pc.css}">
<!-- END_MODULE File_Mtime -->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment