Skip to content

Instantly share code, notes, and snippets.

@Khanashima
Created April 22, 2014 12:07
Show Gist options
  • Save Khanashima/11176280 to your computer and use it in GitHub Desktop.
Save Khanashima/11176280 to your computer and use it in GitHub Desktop.
共通のテンプレートにアクション毎に設定できる追加ファイルを読み込ませる ref: http://qiita.com/kiimiiis/items/c48cb7136ac88c70b724
<script type="text/javascript" src="http://localhost/fuelphp/assets/js/test.js?1398130262"></script>
<script type="text/javascript" src="http://localhost/fuelphp/assets/js/hello.js?1398130262"></script>
<div>
コンテンツ領域です
</div>
<?php
//テンプレートの</body>タグ直前に読み込ませたいファイルを指定。グループはjs
//test.js, hello.jsは/public/assets/js/配下に置く
Asset::js(array('test.js', 'hello.js'), array(), 'js', false);
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<header>
<?php echo $header; ?>
</header>
<div id="content">
<?php echo $content; ?>
</div>
<footer>
<?php echo $footer; ?>
</footer>
<?php
//</body>の直前にjsグループで定義したjsファイルを読み込ませる。このファイルは各アクション毎に設定
//jsグループのjsファイルを表示
echo Asset::render('js');
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment