TOOL更新_Ver0.1Zd(次バージョン)サンプルを『kazpgm.ddo.jp』に載せる。の、続き
TOOL更新_Ver0.1Zd(次バージョン)サンプルを『kazpgm.ddo.jp』に載せる。の、続き
1.http: //kazpgm.ddo.jp/samples/kazBase/kaz/admin/item/itema/list?mode=listで以下エラーになる。
ErrorController.php line=27 Action.php line=513 Standard.php line=296 Front.php line=954 adminIndex.php line=28 : /xxxx/xxxx/samples/kazBase/.php/ZendFramework-1.10.7/ library/Zend/Controller/Dispatcher/Standard.php:249: Invalid controller specified (itemA)
2.どこで出しているのかと、原因を調べた。
結果としてクラス名”Item_ItemaController”を呼ぶことがわかった。”itemA”をやめて"itema"にしてさらにプログラム名も”Item_ItemaController”に変える必要がある。
//■調査内容。このプログラマで落ちている。 class Zend_Controller_Dispatcher_Standard extends Zend_Controller_Dispatcher_Abstract { ・・・ public function isDispatchable(Zend_Controller_Request_Abstract $request) { $className = $this->getControllerClass($request); if (!$className) { return false; } $finalClass = $className; if (($this->_defaultModule != $this->_curModule) || $this->getParam('prefixDefaultModule')) { $finalClass = $this->formatClassName($this->_curModule, $className); } //■どんなクラス名を想定しているか表示してみる。 print_r("===finalClass名===\n"); print_r($finalClass); print_r("\n"); exit; if (class_exists($finalClass, false)) { return true; } $fileSpec = $this->classToFilename($className); $dispatchDir = $this->getDispatchDirectory(); $test = $dispatchDir . DIRECTORY_SEPARATOR . $fileSpec; return Zend_Loader::isReadable($test); } public function dispatch(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response) { $this->setResponse($response); /** * Get controller class */ if (!$this->isDispatchable($request)) { $controller = $request->getControllerName(); if (!$this->getParam('useDefaultControllerAlways') && !empty($controller)) { require_once 'Zend/Controller/Dispatcher/Exception.php'; //■ここでエラーになっている。 throw new Zend_Controller_Dispatcher_Exception('Invalid controller specified (' . $request->getControllerName() . ')'); } ■ーーーーーーーーーーーーーーーー print_r結果 ====finalClass Name ==== Item_ItemaController ■ーーーーーーーーーーーーーーーー
3.とりあえず//kazpgm.ddo.jp/samples/kazBase/kaz/admin/item/itema関連(管理者側の「使用できる項目管理」)だけ修正してみる。
(1)プログラム名とプログラム中の"ItemA"を"Itema"に全置換、"itemA"を"itema"に全置換した
■コントローラ <<修正前>> .kazphp/application/admin/item/ItemAController.php <<修正後>> .kazphp/application/admin/item/ItemaController.php
■モデル <<修正前>> .kazphp/application/admin/item/ItemAUtil.php <<修正後>> .kazphp/application/admin/item/ItemaUtil.php
■業務メニュー <<修正前>> .kazphp/templates/view/admin/menu.lbi <<修正後>> .kazphp/templates/view/admin/menu.lbi
■smarty用テンプレート <<修正前>> .kazphp/templates/view/admin/item/itemAAmendRegisterViewInc.html .kazphp/templates/view/admin/item/itemAAmendView.html .kazphp/templates/view/admin/item/itemAAmendView.html .kazphp/templates/view/admin/item/itemAListView.html .kazphp/templates/view/admin/item/itemARegisterView.html <<修正後>> .kazphp/templates/view/admin/item/itemaAmendRegisterViewInc.html .kazphp/templates/view/admin/item/itemaAmendView.html .kazphp/templates/view/admin/item/itemaDetailView.html .kazphp/templates/view/admin/item/itemaListView.html .kazphp/templates/view/admin/item/itemaRegisterView.html
4.今度このエラーになる。これはsmartyのテンプレート名の先頭大文字小文字違い。
ControllerBase.php line=81 ControllerAdminBase.php line=55 Action.php line=513 Standard.php line=300 Front.php line=954 adminIndex.php line=28 : The Other Error occurred. /xxxx/xxxx/samples/kazBase/.kazphp/common.php:147: Errno: 512 Errortype: User Warning Message: Smarty error: unable to read resource: "view/admin/item/ItemaListView.html" Filename: /xxxx/xxxx/samples/kazBase/.php/smarty/Smarty.class.php Linenum: 1093
■コントローラを修正した。 <<修正前>> .kazphp/application/admin/item/ItemaController.php ・・・ // viewに使用する名前(先頭の共通部分) // 例 return 'logininfo'; protected function _getViewHeadName() { return 'Itema'; } <<修正後>> .kazphp/application/admin/item/ItemaController.php ・・・ // viewに使用する名前(先頭の共通部分) // 例 return 'logininfo'; protected function _getViewHeadName() { return 'itema'; }
5.今度このエラーになる。これはcommon.phpの「DIR_UPLOAD」と「DIR_UPLOAD_WEB」の指定間違い。
ControllerAdminBase.php line=118 Action.php line=513 Standard.php line=300 Front.php line=954 adminIndex.php line=28 : The Other Error occurred. /xxx/xxxx/samples/kazBase/.kazphp/common.php:147: Errno: 2 Errortype: Warning Message: mkdir() [<a href='function.mkdir'>function.mkdir</a>]: No such file or directory Filename: /xxxx/xxxx/samples/kazBase/.kazphp/functions.php Linenum: 287
■common.phpを修正した。 <<修正後>> // uploadした画像ファイルを置くディレクトリ define('DIR_UPLOAD', '/xxxx/xxxx/samples/kazBase/kaz/upload/'); define('DIR_UPLOAD_WEB', '/upload/');
6.http://kazpgm.ddo.jp/samples/kazBase/kaz/admin/ でログイン。管理者側の「使用できる項目管理」が動いた。
2011/01/29 15:00-18:00 これで、ZEND FRAMEWORKで作った自分のプログラムがLinuxで動くことを確認したことになる。、、、あんなことや、こんなこと、いろいろ自分的な作りにしてみたがやっぱりZEND FRAMEWORKもそこそこ柔軟だった。(コントローラのクラス名の先頭以外小文字だというのは、やっぱりそうなのか(聞いてた通り)っていう感想。なので驚いたりはしない。)
2011/01/30 16:10-16:10 「common.php」で「define('DIR_UPLOAD_WEB', '/upload/');」としなくてはいけないところを「define('DIR_UPLOAD_WEB', '/samples/kazBase/kaz/upload/');」にしてしまったため画像が表示されなかった。当ブログを直接修正した。