User Profile

User
 alkemann
Location
 Bergen, Norway
Time Zone
 
Bio
 alkemann on irc

Recent Articles

MenuHelper

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. Created for the purpose of main, sub and context sensitive menues, this helper can also be used as an html UL generator.
  • Published by alkemann 02/04/09 - 14:02
  • 13728 views
  • 1 comment

Revision Behavior - Revision control made easy

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 changes and even get a difference array for seeing changes over time to any (or all) fields.
  • Published by alkemann 12/18/08 - 10:47
  • 17496 views
  • 24 comments

FlashHelper - a wrapper for the SwfObject js class

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 reliable way of adding flash to your projects, look now further, the FlashHelper is here to help.
  • Published by alkemann 11/25/08 - 03:29
  • 18762 views
  • 7 comments

LogableBehavior

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's intent is to easily let you (the developer) log users activities that relates to database modifications (ie, add, edit and delete). If you just want to see what your users are doing or need to be able to say "That is not a bug, I can see from my log that you deleted the post yesterday." and don't want to spend more time that it takes to do "var $actsAs = array('Logable');" then this behavior is for you.
  • Published by alkemann 10/21/08 - 23:47
  • 16823 views
  • 16 comments

OrderedBehavior (2.1)

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, isFirst, isLast and off course inserts itself into saves and deletes to keep the lists correct. It does also have the option of sorting an entire table as one list, if that is what you need. I hope you find it useful.
  • Published by alkemann 09/21/08 - 20:59
  • 11864 views
  • 8 comments

Recent Comments

Posted 05/06/2009 09:59am
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.
Posted 04/06/2009 03:10pm
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;
  }
}
?>
Posted 03/06/2009 08:32am
I unpublished your comment as I published the article. Greate work. Thank you.
Posted 02/06/2009 06:09am
Should it not also use $Controller->Auth-> isntead of $this->Auth?
Posted 01/06/2009 11:22am
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.