[TYPO3-ect] General feedback for lib/div

Max Beutel nash at nashweb.de
Sat Jun 9 14:32:12 CEST 2007


Ries van Twisk schrieb:
> 
> On Jun 9, 2007, at 3:17 AM, Max Beutel wrote:
> 
>> Hello there,
>>
>> after I already built some smaller extensions based on lib div I would
>> like to give some feedback. I think the way you can program your
>> extensions with lib/div is a very good one. It keeps the code a lot
>> cleaner and more organized then the "traditional" approach.
>>
>> Here are the points I noticed when working with lib/div and the MVC
>> kickstarter (v. 0.0.1):
>>
>> 1. The kickstarter generates the view class "tx_sasda_views_sdaadsdas"
>> but puts it in the file "views/class.tx_sasda_view_sdaadsdas.php".
>> Notice the "view" and "views" difference.
> 
> 
> What IS correct?
> I call my diretories plural liek this
> 
> controllers
> views
> models
> libs
> etc...
> 
> then my files are called
> class.tx_sasda_view_sdaadsdas.php
> class.tx_sasda_model_sdaadsdas.php
> class.tx_sasda_controller_sdaadsdas.php
> 
> I think I have sometimes seen that the filename is called plural like  
> this:
> class.tx_sasda_views_sdaadsdas.php
> class.tx_sasda_models_sdaadsdas.php
> class.tx_sasda_controllers_sdaadsdas.php
> 
> 
> 
> Or was that just the broken kickstarter?
> 
I dont know whats correct but it should be either or. A file with the 
name class.tx_foo_views.php should contain class tx_foo_views {} and a 
file class.tx_foo_view.php should contain class tx_foo_view {}, thats at 
least what I think.


>>
>>
>> 4. This point is about image generation with lib/div. I tried to  use the
>> class tx_lib_image in one of my extensions but decided against it
>> because of some disadvantages I thought I have noticed.
> 
> 
> I never used that class since it's not flexible (for me)
> I am mainly using smarty and created a image generation method
> on my view. If you are interested I can send you some sample code.
> 
> The idea is that once I need a image, I can generate it when needed.
> Since I am doing it my view I can decide at that point what
> resolution etc I need.
> I don't like to do it in my model or controller
> since then I need to loop over data again.
> 

Ah, thats actually a good idea and probably the right approach; I would 
be quite interested in the way you implemented this.


>>
>> Consider a situation like this: You have an array of database rows,  each
>> contains among other an image which should be rendered as a thumbnail.
>> If you use tx_lib_image it would be somewhat like this:
>>
>> <code>
>> while($row = $db->sql_fetch_assoc($res)) {
>>      $thumb = new tx_lib_image();
>>      $thumb->alt = $row['title'];
>>      $thumb->height = 100;
>>      $thumb->path = $row['image'];
>>
>>      $row['image_thumb'] = $thumb->make();
>>      $this->rows[] = $row;
>> }
>> </code>
>>
>> That seems pretty much straight forward, but I cant imagine how this
>> approch can work for more complex image operations. For example  masking
>> images onto each other, combining images etc. Can there be a way  without
>> the traditional $config-Typoscript array? I couldnt find one and used
>> the traditional approach with a local CObj and passing a config  array to
>> it.
> 
> 
> I mainly use a configuration array pulled up from my setup.txt.
> This allows for flexible image generation.
> 

True, thats what I did, too.

> Let's fo this...
> i will create a small extension based on smartView
> and put that on TER.
> 
> I will call it maracuyá or something.

Great, I am really looking forward to this extension!


More information about the TYPO3-team-extension-coordination mailing list