[TYPO3-ect] General feedback for lib/div
Max Beutel
nash at nashweb.de
Sat Jun 9 10:17:39 CEST 2007
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.
2. As it seems I cant add a model without having a table to which the
model get assigned.
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.
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.
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.
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?
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?
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
More information about the TYPO3-team-extension-coordination
mailing list