取得
展開
CakePHPDir/
+ app/
.htaccess ※ 編集
app_controller.php ※ 新規作成
and more ...
+ config
core.php ※ 編集
database.php ※ database.php.default をリネーム・編集
+ tmp ※ chmod 777
+ smarty ※ 新規作成
+ cache ※ 新規作成, chmod 777
+ compile ※ 新規作成, chmod 777
+ views
smarty.php ※ Smarty View Class(smarty.php) 配置
+ webroot
.htaccess ※ 編集
index.bin ※ index.php をリネーム
and more ...
+ cake/
+
and more ...
+ venders/
+ smarty/ ※ smarty/libs 以下のファイルを展開(『smarty』ディレクトリ名はすべて小文字)
Smarty.class.php
and more ...
.htaccess ※ 編集
and more ...
編集
http://www33.atpages.jp/~cakephpdemo/ に CakePHP をインストールした場合の例。(アカウント名 cakephpdemo)
CakePHPDir/.htaccess
# 追加 *.bin を *.php と同様に扱う AddType application/x-httpd-php .bin <IfModule mod_rewrite.c> RewriteEngine on # 追加 RewriteBase /~cakephpdemo/ # RewriteRule ^$ app/webroot/index.php [L] を以下に変更 RewriteRule ^$ app/webroot/index.bin [L] RewriteRule (.*) app/webroot/$1 [L] </IfModule>
CakePHPDir/app/.htaccess
<IfModule mod_rewrite.c> RewriteEngine on # 追加 RewriteBase /~cakephpdemo/app/ RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L] </IfModule>
CakePHPDir/app/webroot/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
# 追加
RewriteBase /~cakephpdemo/app/webroot/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] を以下に変更
RewriteRule ^(.*)$ index.bin?url=$1 [QSA,L]
</IfModule>
編集後、http://www33.atpages.jp/~cakephpdemo/ へアクセスし、CakePHP の画面が表示されることを確認する。Notice/Warning 連発だがいちおうアクセスできていることがわかる。アクセス権限がらみのものは修正する。
CakePHPDir/app/config/core.php の Security.salt
// Configure::write('Security.salt', 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi'); // を修正
Configure::write('Security.salt', 'anythingyouwant');
これが何を意味するかは調査中。とりあえず Notice を消す。
CakePHPDir/app/config/database.php
var $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'foo',
'password' => 'your_db_password',
'database' => 'db0foo',
'prefix' => '',
'encoding' => 'utf8',
);
atpages で利用する場合、最低 login, password, database を編集。atpages アカウント管理 で。
ここまでで、Warning/Notice がすべて消えるはず。
smarty 導入
CakePHPDir/app/views/smarty.php 設置
CakePHPDir/app/tmp/smarty, CakePHPDir/app/tmp/smarty/cache, CakePHPDir/app/tmp/smarty/compile のディレクトリを掘り、cache, compile は chmod 777 に。
CakePHPDir/app/app_controller.php を新規作成
CakePHPDir/app/tmp/smarty, CakePHPDir/app/tmp/smarty/cache, CakePHPDir/app/tmp/smarty/compile のディレクトリを掘り、cache, compile は chmod 777 に。
CakePHPDir/app/app_controller.php を新規作成
class AppController extends Controller {
var $view = 'Smarty'; // 追記
}
添付ファイル