/* CakePHP x Smaryt README for me */ 1.) 取得 CakePHP の取得 : http://cakephp.org/ Smarty View Class の取得 : (smarty.php) http://cakeforge.org/snippet/detail.php?type=snippet&id=6 Smarty の取得 : http://www.smarty.net/ 2.) 展開 CakePHPDir/ + app/ .htaccess ※ 編集 and more ... + views smarty.php ※ Smarty View Class(smarty.php) 配置 + webroot .htaccess ※ 編集 index.bin ※ index.php をリネーム and more ... + cake/ + and more ... + venders/ + smarty/ ※ smarty/libs 以下のファイルを展開 Smarty.class.php and more ... .htaccess ※ 編集 and more ... 3.) 編集 http://www18.atpages.jp/~mhfanalysis/ に CakePHP をインストールした場合の例。(アカウント名 mhfanalysis) * CakePHPDir/.htaccess ------------------------------------------------------------------------------------------ # 追加 広告を非表示にするため、*.bin を *.php と同様に扱う AddType application/x-httpd-php .bin RewriteEngine on # 追加 RewriteBase /~mhfanalysis/ # RewriteRule ^$ app/webroot/index.php [L] を以下に変更 RewriteRule ^$ app/webroot/index.bin [L] RewriteRule (.*) app/webroot/$1 [L] ------------------------------------------------------------------------------------------ * CakePHPDir/app/.htaccess ------------------------------------------------------------------------------------------ RewriteEngine on # 追加 RewriteBase /~mhfanalysis/app/ RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L] ------------------------------------------------------------------------------------------ CakePHPDir/ および CakePHPDir/app/ へのアクセスは、 http://www18.atpages.jp/~mhfanalysis/ にアクセスすると、 http://www18.atpages.jp/~mhfanalysis/app/webroot/index.bin にアクセスすることになる。 http://www18.atpages.jp/~mhfanalysis/foo にアクセスすると、 http://www18.atpages.jp/~mhfanalysis/app/webroot/foo にアクセスすることになる。 * CakePHPDir/app/webroot/.htaccess ------------------------------------------------------------------------------------------ RewriteEngine On # 追加 RewriteBase /~mhfanalysis/app/webroot/ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f #RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] を以下に変更 RewriteRule ^(.*)$ index.bin?url=$1 [QSA,L] ------------------------------------------------------------------------------------------ CakePHPDir/app/webroot へのアクセスは、 http://www18.atpages.jp/~mhfanalysis/foo にアクセスすると、 http://www18.atpages.jp/~mhfanalysis/index.bin?url=foo にアクセスすることになる。 ここまででとりあえず http://www18.atpages.jp/~mhfanalysis/ にアクセスし、CakePHP の画面が 表示されることを確認する。 Warning, Notice が消えるように、パーミッションを変更、編集 CakePHPDir/app/tmp, CakePHPDir/app/tmp/cache を書き込み可能にする。chmod 777 ... * CakePHPDir/app/config/core.php ------------------------------------------------------------------------------------------ Configure::write('Security.salt', '任意の文字列'); ------------------------------------------------------------------------------------------ * CakePHPDir/app/config/database.php CakePHPDir/app/config/database.php.default をコピーし、MySQL の DSN 編集 * CakePHPDir/app/views/smarty.php (Smarty View Class) ------------------------------------------------------------------------------------------ // _getViewFileName メソッド内 //if (!is_null($this->webservices)) { を以下に変更 if (isset($this->webservices) && !is_null($this->webservices)) { ------------------------------------------------------------------------------------------