http://stackoverflow.com/questions/42281405/mamp-phpmyadmin-is-not-active#42287871
MAMP shows only two versions of PHPPHP7系が2つ表示されていたので、/Applications/MAMP/bin/php/ 内のフォルダを整理して(どうも降順で選択されるぽい)、無事php5系が表示されました。
正解に辿りつくのにめちゃくちゃ時間がかかった…
http://stackoverflow.com/questions/42281405/mamp-phpmyadmin-is-not-active#42287871
MAMP shows only two versions of PHPPHP7系が2つ表示されていたので、/Applications/MAMP/bin/php/ 内のフォルダを整理して(どうも降順で選択されるぽい)、無事php5系が表示されました。
'userModel' => 'AppUser',該当ブロックは以下の様になります。
public $components = array(
'Session',
'Flash',
'Acl',
'Auth' => array(
'loginAction' => array(
'controller' => 'app_users',
'action' => 'login',
'plugin' => false
),
'loginRedirect' => array(
'controller' => 'posts',
'action' => 'index'
),
'logoutRedirect' => array(
'controller' => 'pages',
'action' => 'display',
'home'
),
'flash' => array(
'element' => 'alert',
'key' => 'auth',
'params' => array(
'plugin' => 'BoostCake',
'class' => 'alert-error'
)
),
'authorize' => array(
'Actions' => array(
'actionPath' => 'controllers',
'userModel' => 'AppUser',
),
),
//'authError' => 'Did you really think you are allowed to see that?',
'authenticate' => array(
'Form' => array(
'passwordHasher' => 'Blowfish',
'userModel' => 'AppUser',
'fields' => array(
'username' => 'username', //Default is 'username' in the userModel
'password' => 'password' //Default is 'password' in the userModel
),
),
),
),
'DebugKit.Toolbar'
);
'userModel' => 'AppUser', public $components = array(
'Session',
'Flash',
'Acl',
'Auth' => array(
'loginAction' => array(
'controller' => 'app_users',
'action' => 'login',
'plugin' => false
),
'loginRedirect' => array(
'controller' => 'posts',
'action' => 'index'
),
'logoutRedirect' => array(
'controller' => 'pages',
'action' => 'display',
'home'
),
'flash' => array(
'element' => 'alert',
'key' => 'auth',
'params' => array(
'plugin' => 'BoostCake',
'class' => 'alert-error'
)
),
'authorize' => array(
'Actions' => array(
'actionPath' => 'controllers',
'userModel' => 'AppUser',
),
),
//'authError' => 'Did you really think you are allowed to see that?',
'authenticate' => array(
'Form' => array(
'passwordHasher' => 'Blowfish',
'userModel' => 'AppUser',
'fields' => array(
'username' => 'username', //Default is 'username' in the userModel
'password' => 'password' //Default is 'password' in the userModel
),
),
),
),
'DebugKit.Toolbar'
);
'userModel' => 'AppUser',at your settings for Auth Component Section in AppController.php.
public $components = array(
'Session',
'Flash',
'Acl',
'Auth' => array(
'loginAction' => array(
'controller' => 'app_users',
'action' => 'login',
'plugin' => false
),
'loginRedirect' => array(
'controller' => 'posts',
'action' => 'index'
),
'logoutRedirect' => array(
'controller' => 'pages',
'action' => 'display',
'home'
),
'flash' => array(
'element' => 'alert',
'key' => 'auth',
'params' => array(
'plugin' => 'BoostCake',
'class' => 'alert-error'
)
),
'authorize' => array(
'Actions' => array(
'actionPath' => 'controllers',
'userModel' => 'AppUser',
),
),
//'authError' => 'Did you really think you are allowed to see that?',
'authenticate' => array(
'Form' => array(
'passwordHasher' => 'Blowfish',
'userModel' => 'AppUser',
'fields' => array(
'username' => 'username', //Default is 'username' in the userModel
'password' => 'password' //Default is 'password' in the userModel
),
),
),
),
'DebugKit.Toolbar'
);
参照元:から説明を抜粋。
http://stackoverflow.com/questions/980556/can-i-use-one-model-inside-of-a-different-model-in-cakephp
App::import() ファイルを見つけてインポートします(それだけしかしません)。クラスを使用するにはインスタンスを作製する必要があります。 ClassRegistry::init() ファイルをロードして、インスタンスを作製します。何かをロードするにはimportよりもベターです。なぜならCakePHPが通常呼び出しの際に内部で行う手続きも実行されるからです。またクラスネームにエイリアスをつけることができます。便利です。 Controller::loadModel() 前述の ClassRegistry::init() を使用してモデルをロードします。$persistModel を使用したキャッシングにも対応します(する予定です?)。コントローラ内部でのみ動作します。
(追記7/7)やっぱりだめっぽい。以下のやりかたが良いようです。Controller::loadModel('AnotherModel'); $data = $this->AnotherModel->read(null, $id);
$anotherModel = ClassRegistry::init('AnotherModel');
data = $anotherModel->read(null, $id);
BUFFALOの無線LANルーター(WHR-G301N等)でブリッジ接続を設定するときの手順この記述が救いでした。 有線で中継器に192.168.11.100にアクセスして無事に設定ができました。
http://wp2.trojanbear.net/1286.html
"今回の設定で一番厄介なのは、BUFFALOの無線LANルーターのディップスイッチをOFFにすると(筆者註:ブリッジモードにする時も)問答無用で無線LANルーターのIPアドレスが192.168.11.100 になってしまう事です。"
case 'year':
(中略)
for ($i = $min; $i <= $max; $i++) {
$data[$i] = $i;
}
(中略)
break;
の箇所を
for ($i = $min; $i <= $max; $i++) {
$wareki = 0;
if ($i > 1988) {
$wareki = $i - 1988;
$data[$i] = "${i}年(平成${wareki}年)";
} elseif ($i > 1925) {
$wareki = $i - 1925;
$data[$i] = "${i}年(昭和${wareki}年)";
} elseif ($i > 1911) {
$wareki = $i - 1911;
$data[$i] = "${i}年(大正${wareki}年)";
} elseif ($i > 1867) {
$wareki = $i - 1867;
$data[$i] = "${i}年(明治${wareki}年)";
} else {
$data[$i] = "${i}年";
}
}
に置き換えます。Logging(CakePHP official)
http://book.cakephp.org/2.0/en/core-libraries/logging.html
Database logging in CakePHP一つ目の記事に書いてあることはCake2.*でもそのままつかえます。ファイルの場所が 'app/libs/log/database_logger.php'(for CakePHP 1.*) から 'app/Lib/Log/Engine/DatabaseLog.php' (for CakePHP 2.*)になるぐらいです。素晴しい。
http://blog.jandorsman.com/blog/database-logging-in-cakephp
public function write($type, $message) {
$log['type'] = ucfirst($type);
$log['created'] = date('Y-m-d H:i:s');
$log['content'] = $message;
if ($login = CakeSession::read('Auth.User')) {
$log['user_id'] = $login['id'];
}
return $this->Log->save($log);
}
Logging(CakePHP official)
http://book.cakephp.org/2.0/en/core-libraries/logging.html
Database logging in CakePHPWell, Jan's article is totally usable even in CakePHP 2.4 except one location 'app/libs/log/database_logger.php'(for CakePHP 1.*) to 'app/Lib/Log/Engine/DatabaseLog.php' (for CakePHP 2.*).
http://blog.jandorsman.com/blog/database-logging-in-cakephp
public function write($type, $message) {
$log['type'] = ucfirst($type);
$log['created'] = date('Y-m-d H:i:s');
$log['content'] = $message;
if ($login = CakeSession::read('Auth.User')) {
$log['user_id'] = $login['id'];
}
return $this->Log->save($log);
}
/*
* dateBy15Minutes
* @assert ("2001-03-10 17:16:18") == "2001-03-10 17:15:00"
* @assert ("2001-03-10 17:00:00") == "2001-03-10 17:00:00"
* @assert ("2001-03-10 17:59:59") == "2001-03-10 17:45:00"
* @assert ("2001-03-10 17:40:18") == "2001-03-10 17:30:00"
*/
protected function _dateBy15Minutes($mode = 'ceil',$time = NULL) {
if (\is_null($time)) {
$time = time();
} else {
$time = \strtotime($time);
}
if ($mode == 'ceil') {
$minute = \sprintf("%02s", \ceil(\date('i') / 15) * 15);
} else {
$minute = \sprintf("%02s", \floor(\date('i') / 15) * 15);
}
$time_string = \date("Y-m-d H:i:s", \mktime(\date('H'), $minute));
return $time_string;
}
参考資料増減するプラグインのために一個一個設置場所を書いていたのですが、うまいことでっちあげたんで、ログとして。
https://github.com/composer/installers
{
"name": "app",
"config": {
"vendor-dir": "Vendor/"
},
"extra": {
"installer-paths": {
"app/Plugin/{$name}/": ["type:cakephp-plugin"]
}
},
"require": {
"php": ">=5.3",
"cakephp/cakephp": "~2",
"composer/installers": "~1",
"cakephp/debug_kit": "~2",
"cakephp/localized": "~2"
}
}
オフラインにしてもオンラインのまま
cakePHPでサブディレクトリで運用する設定に加えて、
http://localhost/test/
のようにtestディレクトリ下でcakeを展開したい場合
各フォルダの3つの.htacessに下記を追加
RewriteBase /test1./test/直下にある.htaccess
<IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] RewriteBase /test </IfModule>2.appディレクトリ直下の.htaccess
<IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L] RewriteBase /test/app </IfModule>3.webrootディレクトリ直下の.htaccess
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,L] RewriteBase /test/app/webroot </IfModule>
"/usr/bin/php" "/Users/xxxx/local/bin/phpunit-skelgen" "--test" "--" "Calculator" "/Users/xxxx/NetBeansProjects/Calculator-PHPUnit/src/Calculator.php" "CalculatorTest" "/Users/xxxx/NetBeansProjects/Calculator-PHPUnit/test/CalculatorTest.php"
phpunit-skelgen 2.0.1 by Sebastian Bergmann.
[InvalidArgumentException]
Command "Calculator" is not defined.
Done.

curl -O https://phar.phpunit.de/phpunit.phar chmod +x phpunit.phar mv phpunit.phar /usr/local/bin/phpunitosxにはwgetがないので curl -O で代用
pear install PHP_CodeSniffer
http://mawatari.jp/archives/introduction-of-cakephp-codesnifferを参考にCakePHPコーディング規約をインストール
$ curl -O http://pear.php.net/go-pear.phar $ php -d detect_unicode=0 go-pear.phar
以下のプラグインもインストールNetBeans に vi プラグインをインストール
http://www.applelife100.com/2012/06/19/netbeans-vi-plugin-install/
http://www.opendns.com/細かい設定は抜きにして、DNSの参照だけに使うなら、
参考サイト:http://wordpress.org/support/topic/get-the-current-url
<a href="><?php
if(is_home()){
bloginfo('url');
} else {
the_permalink();
}
?>"></a>