- 追加された行はこの色です。
- 削除された行はこの色です。
* symfonyの簡単なまとめ [#i6b39216] ** インストール [#jddf979f] pear channel-discover pear.symfony-project.com pear install symfony/symfony-1.2.10 ** モジュールの追加 [#e241f351] frontendアプリケーションにcontentモジュールを追加。 cd PROJECT_DIR symfony generate:module frontend content ** アクションの追加 [#b9370f0f] showアクションを追加。URLは http://localhost/frontend_dev.php/content/show になる。 - actions/actions.class.php <?php class contentActions extends sfActions { public function executeShow() { $this->mesg = 'SHOW!'; } } - content/templates/showSuccess.php <html> <body> <?php if ($mesg): ?> [<?php echo $mesg ?>] <?php endif; ?> </body> </html> ** ページのレイアウト [#vffd1fbc] sampleモジュールのindexアクションのページを考えると、デフォルトの構成では、以下のように2つのファイルを使い、レイアウトに<html>タグや<head>タグを記述し、テンプレートには<body>内を記述する。 :レイアウトファイル|apps/frontend/templates/layout.php :テンプレートファイル|apps/frontend/modules/sample/templates/indexSuccess.php *** 任意のレイアウトを指定する [#je43e40e] - apps/frontend/templates/my_layout.php - /apps/frontend/modules/sample/config/view.yml: all: has_layout: on indexSuccess: layout: my_layout ** テンプレートからテンプレートを呼び出す [#hfdd63e8] *** 部分テンプレート [#e8e09f07] 以下のようにテンプレートに記述する。 <?php include_partial('mypartial1') ?> # frontend/modules/mymodule/templates/_mypartial1.phpが呼び出される <?php include_partial('foobar/mypartial2') ?> # frontend/modules/foobar/templates/_mypartial2.phpが呼び出される 部分テンプレート内で変数を参照するには、呼び出す際に以下のようにすると、mytotal変数に参照出来る。 <?php include_partial('mypartial', array('mytotal' => $total)) ?> *** コンポーネント [#y27476cb] TODO