[TYPO3-ect] where is the eboard extension ?
Fabien Udriot
fudriot at omic.ch
Sat Jun 2 13:11:25 CEST 2007
Great ! I'm looking forward !
I started my last extension with the MVC model proposed by lib/div. I
have not tested every thing but until now, I have very a positiv feed-back.
lib/div makes the developer's life easier with a nice API. It makes me
also happy to code with modern concept whitin Typo3. (which is not
always the case ...)
A lot of fun. Thanks !
Here is my feed-back about the README file :
> Understanding the SPL objects chain:
> ======================================
>
> SPL (Simple PHP Library) objects have a lot in common with
> array.
[I would add :]
SPL offers very usefull method to access data (like traversing array) in
an object oriented style. This extension is available and compiled by
default in PHP 5. The iterator pattern illustrates it :
$iterator = new MysqlIterator();
for($iterator->rewind(); $iterator->valid(); $iterator->next())
{
$data = $iterator->current();
}
> You process your data through the request lifecycle
> by "feeding" on SPL object as input to the next:
>
> request > object1 > object2 ... objectX > response
[Don't you thing a little example would be welcome ? I would add
something like : ]
-> create SPL objects in the MODEL
class tx_myExtension_models extends tx_lib_object {
function someFunction(){
//typically, $row comes from the database.
$row = Array('values' => 1);
//create a SPL object.
$entry = new tx_lib_object($row);
}
}
-> transfer SPL objects from the MODEL to the CONTROLLER
class tx_myExtension_controllers extends tx_lib_controller {
function defaultAction(){
$modelClassName =
tx_div::makeInstanceClassName('tx_myExtension_models');
$model = new $modelClassName();
for($model->rewind(); $model->valid(); $model->next()){
$entry = new $entryClassName($model->current());
$entry->setController($this);
$view->append($entry);
}
}
-> display SPL object from the CONTROLLER to the VIEW
<?php for($this->rewind(); $this->valid(); $this->next()): $entry =
$this->current();?>
<p class="title"><?php $entry->printAsText('values'); ?></p>
<?php endfor; ?>
A simple and concrete implementation can be found in the bananas extension.
> Understand the "Central Triad":
> ===============================
>
> * $controller - The controller object.
> * $parameters - Object containing the request parameters.
[I would add :]
POST - GET values are passed as follow :
myExtensionName[myParameter]=myValue
[question : can parameters be something else than POST - GET parameters ?]
Elmar Hinz a écrit :
> Am Thu, 31 May 2007 18:18:18 +0200 schrieb Fabien Udriot:
>
>> Hello,
>>
>> In the apples extension (which is a good inspiration source for me with
>> bananas), it is mentioned :
>>
>> * For a minimal practical example see the extension eBoard (eboard).
>> * For a bigger practical example see the extension eFAQ (efaq).
>>
>>
>> But where is the "eboard" extension ? Not in the TER.
>
> Hi Fabien,
>
> the name eBoard is depreciated. I decided that bananas is more funny and
> matches better with apples. I plan to publish a third tutorial extension
> and I will call it cherries.
>
> lib/div will go to beta as soon as it is clear that we don't need to rename
> functions any more. However I already do all my projects with it. Still I
> am carefully changing some central parts. I.e. you will understand the new
> central controller on one glance:
>
> function main($in = NULL, $configurationArray){
> $this->_createConfigurations($configurationArray);
> $this->_createParameters();
> return $this->_runControllerAndAction( $this->_findControllerAndAction() );
> }
>
>
> Latest altrerations as always in SVN:
> <http://svn.t3.digitaldistrict.de/cgi-bin/trac.cgi/browser/typo3xdev/tx_lib/trunk>
>
>
> I add some documentation from the upcoming README file:
>
>
>
>
> lib/div in a nutshell
>
>
> Learn from example extensions in TER:
> =====================================
>
> 1.) Hello World: apples - A very minimalistic example.
> 2.) Beginners example: bananas - A workging guestbook.
> 3.) Advanced example: efaq - FAQ with many modern features.
>
>
> Understanding the SPL objects chain:
> ======================================
>
> SPL (Simple PHP Library) objects have a lot in common with
> array. You process your data through the request lifecycle
> by "feeding" on SPL object as input to the next:
>
> request > object1 > object2 ... objectX > response
>
>
> Understand the class hierarchy:
> ===============================
>
> All classes inherit from the class tx_lib_object:
>
> tx_lib_object
> |
> ---------------------------------
> | | |
> tx_lib_controller tx_lib_model tx_lib_view
> | | |
> yourController yourModel yourView
>
>
>
> Understand the "Central Triad":
> ===============================
>
> * $controller - The controller object.
> * $parameters - Object containing the request parameters.
> * $configurations - Object containing all configurations.
>
> $configurations $parameters
> | |
> $controller
> |
> $exampleObject // Represting all "controlled" objects.
>
>
> Mind 3 central rules:
> =====================
>
> [1] The controller is the central object. It must be set to each
> "controlled" object of your extension, either by constructor
> or by function or directly.
>
> a.) By the constructor: $exampleObject = new exampleClass($this);
> b.) BY function: $exampleObject->controller($this);
> c.) Directly: $exampleObject->controller = $this;
>
> [2] Each "controlled" object can always access the "Central Triad"
> via the controller:
>
> a.) $this->controller
> b.) $this->controller->configurations
> c.) $this->controller->parameters
>
> [3] Remember that you can simply extend your controller by
> registering new actions to it from other extensions.
More information about the TYPO3-team-extension-coordination
mailing list