主要是因為之前用Yii 的 Widget 用的挺開心的( 除了他會每次都進一次Cycle 外) 因為用ZF沒找到有這方面相關的資訊 所以自已動手刻….. 1. 在application 下建 Titan/Base 的資料夾 ( Titan 是我想把自已寫的東西盡可能的都收在這 ) 2. vim Titan/Base/Widget.php [sourcecode language='php'] < ?php abstract class Titan_Base_Widget { protected $_basePath; protected $_viewBasePath; protected $_viewScriptPath; public function __construct( $array = null ) { //assign variables $this->_basePath = APPLICATION_PATH . DS . ‘widgets’; $this->_viewBasePath = APPLICATION_PATH . [...]
posted in program, ZendFramework by johnpupu
[cc lang="php" tab_size="2" lines="40"]public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array()) { $this->setRequest($request) ->setResponse($response) ->_setInvokeArgs($invokeArgs); $this->_helper = new Zend_Controller_Action_HelperBroker($this); $this->init(); }[/cc] 在zf 每個 controller 中 可以用function init 這個去代替__constructor (不知道這樣形容 恰不恰當) Whenever Zend Framework instantiates a controller, the base Zend Framework class (in our case Zend_Controller_Action) has a lot of important code in the [...]
posted in ZendFramework by johnpupu