2009-11-04

Obama and ACTA

This is so important, its found a place even in this blog:
http://www.boingboing.net/2009/11/03/secret-copyright-tre.html

Hashes: #ACTA #obama #copyright #usa #eu

2009-11-03

Kohana modules hack

When adding modules to kohana, most oftenly you need to add that module to the config file to have it loaded. Now I find this mostly an unnecessary hassle. (Its useful when sharing module path between applications, though).

However, just comment out the module settings, replacing it with this code snippet:

$config['modules'] = array();
foreach (scandir(MODPATH) as $folder) {
if ($folder != '.' && $folder != '..') {
$config['modules'][] = MODPATH . $folder;
}
}

That'll load all your modules automatically. :)

Hashes: #kohana #php

Excel export module

Important! All Kohana-related posts are now at http://kohana.lillem4n.se.

This is a excel export module to Kohana. Simpel use like this:
$excelExport = new Excel_export();
$excelExport->addRow(array('first row, first column','first row, second column'));
$excelExport->addRow(array('second row, first column','second row, second column'));
$excelExport->download('myExcelFile.xls');

Full documentation of all available methods and parameters are in the module library source.

Bug reports, comments, improvements; very welcome. :)

Hashes: #kohana excel export module #kohana module #kohana #excel export #php

2009-11-01

Kohana extended form rules

Important! All Kohana-related posts are now at http://kohana.lillem4n.se.

New version available here, a post about this issue is located here.

This is a module with rules you'd like when validating forms in kohana. It is the same concept as the valid::-rules.

For example:
$post->add_rules('some_field', 'required', 'digit', 'formrules::positive');


This will require "some_field" to be a digit (whole number) above zero.

For now, positive is actually the only rule in this module. So it is more like the foundation of a module. :) More rules will follow.

Hashes: #kohana form rules module #kohana module #kohana #form validation #php