Ok, I am now having an issue and require help.
The original code:
Code: Select all
function tablename_init(&$options, $memberInfo, &$args){
// modify the status field of the table view query to display 'no' invoices in bold red
$oldArray=$options->QueryFieldsTV;
$options->QueryFieldsTV='';
foreach($oldArray as $field => $caption){
if($field=='`tablename`.`fieldname`'){
$options->QueryFieldsTV['IF(`tablename`.`fieldname`=\'yes\', \'<b style="color: green;">YES</b>\', IF(`tablename`.`fieldname`=\'no\', \'<b style="color: red;">NO</b>\', `tablename`.`fieldname`))']=$caption;
}else{
$options->QueryFieldsTV[$field]=$caption;
}
}
return TRUE;
This code works fine to replace the field text with a specific string, for example <b>Yes</b>. Where the field has the value of Yes, it will be replaced with <b>Yes</b>
Now, what I want to do is wrap the <b></b> tags around EXISTING data. To explain, the table already has data in. What I want it to do is when one field says yes, make the data already in the other field bold.
I am close to this with this code:
Code: Select all
// modify the status field of the table view query to display 'Windows Update' drivers in bold red
$oldArray=$options->QueryFieldsTV;
$options->QueryFieldsTV='';
foreach($oldArray as $field => $caption){
if($field=='`SaD`.`info`'){
$options->QueryFieldsTV['IF(`SaD`.`source`="Windows Update", "<b>Yes</b>", `SaD`.`info` )']=$caption;
}
else{
$options->QueryFieldsTV[$field]=$caption;
}
}
This code checks to see if the data in
SaD.source says Windows Update. If it does it replaces the data in
SaD.info with Yes. However, what I want to do is wrap the existing data in the SaD.info field with <b> tags so it makes that data bold.
I tried this but it does not work:
Code: Select all
// modify the status field of the table view query to display 'Windows Update' drivers in bold red
$oldArray=$options->QueryFieldsTV;
$options->QueryFieldsTV='';
foreach($oldArray as $field => $caption){
if($field=='`SaD`.`info`'){
$options->QueryFieldsTV['IF(`SaD`.`source`="Windows Update", "<b style=color:red>"SaD.info"</b>", `SaD`.`info` )']=$caption;
}
else{
$options->QueryFieldsTV[$field]=$caption;
}
}
To give a worked example, if SaD.source said "Windows Update" and SaD.info said "Windows OS Kernel Driver", I want to make the "Windows OS Kernel Driver" bold.
Does this make sense? Can anyone help? I have been trying for ages to get this to work!!!
Thanks to anyone who can help
Stephen