Category Archives: ZendFramework

Zend Framework Widget

主要是因為之前用Yii 的 Widget 用的挺開心的( 除了他會每次都進一次Cycle 外)
因為用ZF沒找到有這方面相關的資訊
所以自已動手刻…..
1. 在application 下建 Titan/Base 的資料夾 ( Titan 是我想把自已寫的東西盡可能的都收在這 )
2. vim Titan/Base/Widget.php

< ?php
abstract class Titan_Base_Widget
{
protected $_basePath;
protected $_viewBasePath;
protected $_viewScriptPath;
public function __construct( $array = null )
{
[...]

Posted in ZendFramework, program | Tagged | 1 Comment

ZF controller init method

[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 __construct() method.  It is possible to override the __construct() in [...]

Posted in ZendFramework | Tagged | Leave a comment