Consider the following table:
CREATE TABLE tblDemo(
pkID INT PRIMARY KEY AUTO_INCREMENT,
fldField1 VARCHAR(40),
fldField2 VARCHAR(40),
fldField3 VARCHAR(40),
fldCertainFields VARCHAR(40),
fldLongField TEXT
);
#include the class
include ('ajaxCRUD.class.php');
#this one line of code is how you implement the class
$tblDemo = new ajaxCRUD("New Item", "tblDemo", "pkID");
$tblDemo->omitPrimaryKey();
$tblDemo->formatFieldWithFunction('fldField1', 'makeBlue');
$tblDemo->formatFieldWithFunction('fldField2', 'makeBold');
#actually show to the table
$tblDemo->showTable();
function makeBold($val){
return "<b>$val</b>";
}
function makeBlue($val){
return "<span style='color: blue;'>$val</span>";
}
Click here to view example outside of the template.
"Very interesting class. Thanks a lot."
~gustavo
" - Posted by gustavo on Friday Jan 8th, 2010 at 11:45am