ã¢ã¯ã·ã§ã³ã³ã³ããã¼ã©ã¼ã®ä¿åãå¤é層å
ã¢ã¯ã·ã§ã³ã³ã³ããã¼ã©ã¼ã®ä¿åãå¤é層åãã¦ãå¤æ°ã®ã³ã³ããã¼ã©ã¼ãæ´çã§ããããã«ããã
Zend_Controller_Dispatcher_Standardã®ã³ã³ããã¼ã©ã¼å解決ã§ãµããã£ã¬ã¯ããªä»æ§ã«ãã¦ã¿ãã
Zend_Controller_Dispatcher_Standardãç¶æ¿ããã¯ã©ã¹ãä½ã£ã¦ã
_formatNameå
ã§ä¸è¨ã®ããã«ä¸è¡å¤æ´ããã
<?php // $segments[$key] = str_replace(' ', '', ucwords($segment)); $segments[$key] = str_replace(' ', $this->getPathDelimiter(), ucwords($segment));
ãã¨ã¯ãããã³ãã³ã³ããã¼ã©ã¼ã«setDispatcherã§newãã¦æ³¨å
¥ããã ãã
/foo-bar/baz/
ã¸ã®ãªã¯ã¨ã¹ãã
controllers/foo/barController.php
ã§å¦çã§ããããã«ãªãã
ãã¥ã¼ã®ä¿åå ´æã«ã¤ãã¦ãåºåã§ããããã«ãªã£ãã
ãã¡ãªãã
ç¶æ¿ããåºåºã¯ã©ã¹ãã¤ã³ã¯ã«ã¼ãããã®ãé¢åã»ã»ã»
ã¢ã¸ã¥ã¼ã«ä¸ã§autoloaderãéããã
åæ©
http://d.hatena.ne.jp/noopable/20090204/1233700976
ãã®é¢ä¿ã§ããã¼ã¸ã¯ã©ã¹ãªã©ã³ã³ããã¼ã©ã¼ã®åé¡ã«æå³ä»ããããã¨ãåæã«å¦çã§ãããã ãDispatcherãã¡ããã¨èª¿æ´ãã¦æ¬¡ã«é²ããã¨ã«ããã
æ¤è¨ããå 容
- ã¢ã¸ã¥ã¼ã«å ã«ã³ã³ããã¼ã©ã¼ãèå¥ã§ãããµããã£ã¬ã¯ããªãä½ãåºåãã
- ç¨éã«ãã£ã¦ã³ã³ããã¼ã©ã¼ã«æ¥é è¾ãä»ãã¦ç®¡çããã
- æ¥é è¾ã«å¯¾å¿ãããã£ãªã¬ã¯ããªã«ã³ã³ããã¼ã©ã¼ãä¿åã
- 解決æ¹æ³ã®å¤æ´
- å
ä»æ§ï¼foo-barã³ã³ããã¼ã©ã¼ã¯FooBarControllerã¸ããã
- ã¯ã©ã¹åã¯Module_FooBarController
- å¤æ´ä»æ§: foo-barã³ã³ããã¼ã©ã¼ã¯foo/BarControllerã¸ããã
- ã¯ã©ã¹åã¯Module_Foo_BarControllerã«ãªãã
- å
ä»æ§ï¼foo-barã³ã³ããã¼ã©ã¼ã¯FooBarControllerã¸ããã
- ã«ã¼ãã£ã³ã°ã®å
é¨ã«ã¼ã«ã¨ãã¦ãpageæ¥é è¾ãæã¤ã³ã³ããã¼ã©ã¼ã«ããããã«éç¨ã
- å¤é¨ããç´æ¥æ¥ã¦ããããããªãã³ã³ããã¼ã©ã¼ã«ã¤ãã¦ã¯ãã³ã³ããã¼ã©ã¼å´ã§Aclå®è£ ãè¡ãã
- dispatcherã®isDispatchableã«æ©è½è¿½å ããæ¹ãåºããããªãã·ã§ã³ã®æ³¨å ¥ãé¢åã