forked from fuel/docs
-
Notifications
You must be signed in to change notification settings - Fork 119
/
advanced.html
151 lines (132 loc) · 5.73 KB
/
advanced.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./../../assets/css/combined.css?20190627">
<link rel="shortcut icon" href="./../../favicon.ico" />
<script src="https://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
var path = './../../';
var class_prefix = "Theme::";
</script>
<script src="./../../assets/js/combined.js?20190627"></script>
<title>Theme 高度な使い方 - クラス - FuelPHP ドキュメント</title>
</head>
<body>
<div id="container">
<header id="header">
<div class="table">
<div id="cse">
<gcse:searchbox-only newWindow="true"></gcse:searchbox-only>
</div>
<h1>
<a href="https://fuelphp.com"><img height="37px" width="147px" src="./../../assets/img/fuel.png" /></a>
<strong>Documentation</strong>
</h1>
</div>
<nav>
<div class="clear"></div>
</nav>
<a href="#" id="toc_handle">目次</a>
<div class="clear"></div>
</header>
<div id="main">
<h2>Theme クラス</h2>
<p>
Theme クラスはアプリケーションにテーマを提供します。
</p>
<h3 id="asset">アセットサポート</h3>
<p>
全てのテーマクラスのインスタンスは、テーマからアセットを簡単に読み込むことができるように、それ自身がアセットクラスのインスタンスを持っています。
アセットのインスタンスはアクティブ用とフォールバック用のテーマのアセットのパスを集合させており、
テンプレートやビューのように、あなたのアセットにも、他のテーマアセットのフォールバックの機能が提供されます。
</p>
<p>例:</p>
<pre class="php"><code>// デフォルトのテーマインスタンスを使ってアセットを読み込む
echo \Theme::instance()->asset->css('bootstrap.css');</code></pre>
<h3 id="advanced_config">高度な設定</h3>
<p>
メソッドの <a href="methods.html#method_active">active()</a>, <a href="methods.html#method_fallback">fallback()</a>,
<a href="methods.html#method_get_info">get_info()</a> そして <a href="methods.html#method_load_info">load_info()</a>
は、デフォルトではインストールしたテーマの名前を文字列で渡すことができます。
これらのメソッドは代わりにテーマ定義の配列を渡すことができ、これらのメソッドへ追加の設定情報を渡すことができます。
</p>
<p>以下のテーマ変数が定義されます:</p>
<table class="config">
<tbody>
<tr class="header">
<th>パラメータ</th>
<th>型</th>
<th>デフォルト</th>
<th>説明</th>
</tr>
<tr>
<th>name</th>
<td>string</td>
<td><strong>必須</strong></td>
<td>テーマの名前。これはパスのディレクトリ名に合わせる必要があります。</td>
</tr>
<tr>
<th>path</th>
<td>string</td>
<td><strong>必須</strong></td>
<td>テーマのパス。これはテーマの名前を含むこと、かつディレクトリセパレータで終わっている必要があります。</td>
</tr>
<tr>
<th>asset_base</th>
<td>string</td>
<td><strong>オプション</strong></td>
<td>
アプリケーションの <strong>DOCROOT</strong> から相対的なこのテーマのアセットへの基準パス。
<strong>DOCROOT</strong> 外の場合はパスを完全修飾にする必要があります。
これはディレクトリセパレータで終了する必要があります。
指定しない場合は、与えられたテーマのパス、設定された assets_folder 、および、設定された
base_url から構築されます。
</td>
</tr>
<tr>
<th>info</th>
<td>array</td>
<td><strong>オプション</strong></td>
<td>テーマの情報配列。未定義の場合は、テーマ情報ファイルから作成されます。</td>
</tr>
<tr>
<th>find_file</th>
<td>boolean</td>
<td><strong>オプション</strong></td>
<td><strong>true</strong> にセットした場合、 <a href="../finder.html#method_search">Finder::search()</a> メソッドがビューファイルとテーマ情報ファイルの場所を突き止めます。</td>
</tr>
</tbody>
</table>
<p>例:</p>
<pre class="php"><code>// 基本的な使い方: インスタンスを作り、アクティブなテーマとしてセットします
$theme = \Theme::forge();
$theme->active('darkglow');
// 高度な使い方
\Config::load('theme', true, false, true);
$config = \Config::get('theme', false);
// 設定値を上書きする
$config['info_file_name'] = 'setupinfo.yaml';
// テーマインスタンスの生成
$theme = \Theme::forge($config);
// アクティブなテーマとして設定
$theme->active(
array(
'name' => 'darkglow',
'path' => APPPATH.'themes'.DS.'darkglow'.DS,
'asset_base' => '/themes/darkglow/assets/',
'find_file' => true,
)
);
</code></pre>
</div>
<footer>
<p>
© FuelPHP Development Team 2010-2019 - <a href="http://fuelphp.com">FuelPHP</a> is released under the MIT license.
[ <a href="https://github.com/fuel/docs/commits/1.8/master/classes/theme/advanced.html">原文コミット履歴</a> | <a href="https://github.com/NEKOGET/FuelPHP_docs_jp/commits/1.8/master_japanese/classes/theme/advanced.html">翻訳コミット履歴</a> | <a href="https://github.com/NEKOGET/FuelPHP_docs_jp/blob/1.8/master_japanese/classes/theme/advanced.html">GitHubで修正</a> ]
</p>
</footer>
</div>
</body>
</html>