> Are you talking about implementing an afterInsert() function in the
> functions.inc file and having that get picked up afterInsert
> for all of the tables?
I would like to implement an afterInsert() only for the tables containing images I need to manipulate.
These functions do an image resize and a thumbnail creation. I want to define these functions somewhere in my app (eg in the root of the app), and call them every time I need them. The image manipulation functions should be available to the various table triggers, eg:
tables/table1/table1.php
[PHP]
include("functions/resize-functions.inc");
function table1_resize(){ // this func pick up the form data and call the resize func
$directory = getcwd() . "/tables/table1/image";
$fileName = $_FILES["image"]["name"];
resizeImage($fileName,$directory,90); // this is defined in functions.inc
}
class tables_table1 {
function afterSave(&$record){
table1_resize();
}
}
[/PHP]
tables/table2/table2.php
[PHP]
include("functions/resize-functions.inc");
function table2_resize(){
$directory = getcwd() . "/tables/table2/image";
$fileName = $_FILES["image"]["name"];
resizeImage($fileName,$directory,90);
}
class tables_table2 {
function afterSave(&$record){
table2_resize();
}
}
[/PHP]
> ... but you can play on PHP's object inheritance
> ability to do this elegantly.
> Create a base class that implements the afterInsert()
> method how you like. Then make your delegate classes
> extend from this class.
Sorry, I'm not very expert with PHP classes and objects.
Is there an example somewhere? I have to look here?
http://framework.weblite.ca/documentation/tutorial/getting_started/delegate_classesThanks,
Claudio