[TYPO3-dev] XCLASS conflict examples

Elmar Hinz elmar.DOT.hinz at team.MINUS.red.DOT.net
Sun Feb 12 17:15:45 CET 2006


Michael Scharkow schrieb:
> In my prototype there is a little more magic going on because you really
> only add methods by subclassing the controller and registering the method:
> 
> class tt_news_pi1 extends fe_controller{
>     $this->register = array('index','singleview','latest','search');
>     function index(){
>         return 'foo';
>     }
>     function singleview(){
>         return 'bar';
>     }
>     ...
> }
> 
> myplugin = new tt_news_pi1;
> myplugin->main();
> 

Which is pretty easy to understand and to do, even for a beginner. Compare the
example code autogenerated by the current kickstarter.

<http://typo3.org/extensions/repository/search/articles/details/?tx_extrepmgm_pi1%5BDATA%5D%5BshowFile%5D=pi1%2Fclass.tx_articles_pi1.php>


$this->register = array('index','singleview');

versus

   function main($content,$conf)    {
        switch((string)$conf['CMD'])    {
            case 'singleView':
                 [...]
                return $this->pi_wrapInBaseClass($this->singleView($content,$conf));
            break;
            default:
                 [...]
                return $this->pi_wrapInBaseClass($this->listView($content,$conf));
            break;
        }
    }

/el







More information about the TYPO3-dev mailing list