Overloading Functions. I am struggling to get this to work has anybody tried it.
I am trying to lookup data from two joomla tables, categories and templates. I have created two CustomFields on the tasks table note_title which is constrained on the joomla category table and title which is constrained on the templates table. I'm trying to insert the data entered project task.
In the project task card I get a drop down box of categories. When I select a category I then want to show the template names for that category in a second drop-down box. I have edited the customfields_fields_extend.lib as follows.
can anybody spot the mistake ?
Thanks
Paul
[code]function customfields_field_editview_projecttaskcard_title (&$currentmodule, &$object, &$parameters, &$action, &$user, &$idvar, &$rightok, &$customfields, &$field, &$name, &$value) {
global $db; // allow to access database functions
$sql="SELECT note_title, title, rowid FROM doli_project_task_customfields INNER JOIN j25_n3ttemplate_categories ON doli_project_task_customfields.note_title = j25_n3ttemplate_templates.category_id WHERE doli_project_task_customfields.fk_project_task=".$object->id;
$result=$db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$i = 0;
$myarray = array();
while ($i < $num)
{
$obj = $db->fetch_object($result);
$myarray []=array('id'=>$obj->rowid, 'value'=>$obj->title);
$i++;
}
$value = $myarray;
$db->free($result);
}
}[/code]
↧