[TYPO3-ect] General feedback for lib/div

Ries van Twisk typo3 at rvt.dds.nl
Sat Jun 9 14:19:43 CEST 2007


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?


>
> 2. As it seems I cant add a model without having a table to which the
> model get assigned.
>
I had that to...
> 3. A minor issue is that the kickstarter still offers the option that
> the view can be a subclass of smartyView, which does not exist.
see attachment..
>
>
> 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.

>
> 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.


>
> Apart from that, if you use the approch from above with new
> tx_lib_image() etc. for every thumb the class tx_lib_image makes a new
> instance of the huge tslib_cObj. Wouldnt it be more effecient to  
> hold a
> global instance of tslib_cObj in a protected member var somewhere  
> in the
> class lib?
>
Lib tried to make a singleton of cObj if I remember,
not sure if he does that in that class.


>
> 5. Let me say something about the implementation of the smarty view. I
> too, made my own smarty integration, using the rtp_smarty  
> extension. But
> here I read that some others already made similar approches.  
> Wouldnt it
> be good if we would share our classes and create an "official" smarty
> view (extension) for lib/div? Or does something like this already  
> exist?
>

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.


>
> Anyway, I think that Elmar did great on lib/div. This is how extension
> programming should be! After a  phase of learning I cant imagine  
> not to
> continue using lib/div! What helped me a lot where the example  
> extensions.
>
> Regards,
>
> Max
> _______________________________________________
> TYPO3-team-extension-coordination mailing list
> TYPO3-team-extension-coordination at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-team- 
> extension-coordination

-- 
Ries van Twisk
Freelance Typo3 Developer
email: ries at vantwisk.nl
web:   http://www.rvantwisk.nl/
skype: callto://r.vantwisk






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