I have a table that has a field 'ImageURL', that has a link to an image.
I want this field to display as an image in table view.
I have tried to achieve this in the table's php file in the hooks folder, seed code.
I know there will be a problem with img src...
Code: Select all
function Person_init(&$options, $memberInfo, &$args) {
// get the original fields array
$oldFields = $options->QueryFieldsTV;
foreach($oldFields as $field => $title){
// find the field that we need to customise
if($field == 'Person.ImageURL'){
// apply custom sql formatting to the field
$modField = "<img src='Person.ImageURL'>";
$newFields($modField) = $title;
}else{
// for other fields, keep them unchanged
$newFields($field) = $title;
}
}
//now apply the modified fields
$options->QueryFieldsTV = $newFields;
return TRUE;
}
[code]
thanks
John