alkemann's Profile

Recent Articles

MenuHelper

Published by alkemann on 4/2/09

A tool for building and rendering lists of links and elements. This helper will let you build up static and context sensitive links in your views and then render them all as part of the layout. It is powerful enough to do multiple, nested lists. C...

Revision Behavior - Revision control made easy

Published by alkemann on 18/12/08

Take full control of any changes your users makes, while also giving them features like undo. Keep a history of previous versions of any database model, allowing you to undo, revert to an older version (or a specific time), manage and inspect chan...

FlashHelper - a wrapper for the SwfObject js class

Published by alkemann on 25/11/08

After having had small issues every time I try to embed flash in my apps, and always resorting to using the javascript SwfObject, I decided it was time to just make a wrapper helper for this helpful vendor. So, if you need a fast, easy and reliabl...

LogableBehavior

Published by alkemann on 21/10/08

This behavior is created to be a plug-and-play database changes log that will work out of the box as using the created and modified fields does in cake core. It is NOT version control, undo or meant to be used as part of the public application. It...

OrderedBehavior (2.1)

Published by alkemann on 21/9/08

This behavior is intended for letting you order models like pages in a book in a the same way that the treebehavior works, with the difference that there is only one level (all the pages are siblings). It includes moveUp, moveDown, moveTo, sortBy,...

Recent Comments

alkemann posted on 06/05/09 09:59:24 AM
Thank you for this contribution. The article is a bit long, please split in into several pages. It is important to clearly separate the shared code and the articles usage examples. I suggest putting background and install instructions on page one, usage examples on page two, the shared code (ie the datasource file) on page three and api on page four.
alkemann posted on 06/04/09 03:10:30 PM
Hey again. Impressive documentation block there :) Maybe you could put some of those examples in the article instead of the code. The php short tags I wanted you to remove are in the view example, short tags is php tag with out php (add it after the question mark). It will colour code the code and also, short tags are bad.

For more content in the actual article I would be interested to hear why you choose to put so much code in php for a javascript function? Also are there not many js library out there that will already do this? Adding some information of why you choose the implementation you did ads a lot to the articles usefulness.

An important change you need to make is to remove the echos from your helper. Cakephp helpers returns strings to the view, and the view echo it. (For instance look at how you use FormHelper). When designing the API for your assets, it's a good idea to study existing core and community build classes and see what they do. For instance, your setup method would work in a more conventional way if it took in an $options array where all of the options where optional, storing defaults in the class. Also giving the option to add the js and css to layout would be useful. For instance:
<?php function setup($options = array(), $inline false) {
  
$this->options array_merge($this->defaultOptions$options);
  if (
$inline) {
    return 
$this->Javascript->link('validation').
       
$this->Html->css('validation');
  } 
// else
  
$view ClassRegistry::getObject('view');
  if (
is_object($view)) {
    
$view->addScript($this->Javascript->link('validation'));
    
$view->addScript($this->Html->css('validation'));
    return 
true;
  } else {
    return 
false;
  }
}
?>
alkemann posted on 06/03/09 08:32:52 AM
I unpublished your comment as I published the article. Greate work. Thank you.
alkemann posted on 06/02/09 06:09:58 AM
Should it not also use $Controller->Auth-> isntead of $this->Auth?
alkemann posted on 06/01/09 11:22:37 AM
Thank you for contribution, but without code or content, I cant really publish this. In any case, you should include in the article information about what it does and how it works. Usage example is good, but an API is even better.