I have a form that is for listing some records from a table (Model - Articles), but also I need to link to another table (Model - Authors) and draw just one field (authorname) from that table.
At the moment I have two multi record loaders that are joined with a custom code action to display the records and that seems to be working. I get a list of records with details from Articles but just can't work out the syntax to reference the other field (authorname) from the second table.
You can see in this code where the authorname needs to go in the list after title.
Your help appreciated.
At the moment I have two multi record loaders that are joined with a custom code action to display the records and that seems to be working. I get a list of records with details from Articles but just can't work out the syntax to reference the other field (authorname) from the second table.
You can see in this code where the authorname needs to go in the list after title.
<?php
foreach($form->data['Articles'] as $detail) {
?>
<tr>
<td><?php echo $detail['title']; ?></td>
<td><?php echo ????????; ?></td>
<td><?php echo $detail['start_publishing']; ?></td>
<td><?php echo $detail['status']; ?></td>
</tr>
<?php
}
?>Your help appreciated.
Hi JeffP,
I've just written this FAQ about linking two DB Multi Record Loader actions. Once you have the settings right it works quite easily and doesn't need any custom code.
Bob
I've just written this FAQ about linking two DB Multi Record Loader actions. Once you have the settings right it works quite easily and doesn't need any custom code.
Bob
Hi Bob
The reason I use custom code is because I want to have links on each row for things like 'Edit' and 'Delete', which I can't do with the data loader.
So I checked that I had everything setup correctly and it is, but still can't figure how to reference the authorname field in the custom code.
Any ideas?
The reason I use custom code is because I want to have links on each row for things like 'Edit' and 'Delete', which I can't do with the data loader.
So I checked that I had everything setup correctly and it is, but still can't figure how to reference the authorname field in the custom code.
Any ideas?
Hi Jeff,
Did you manage to solve this ?
You can use a debugger action or this code:
Regards,
Max
Did you manage to solve this ?
You can use a debugger action or this code:
<?php print_r2($form->data); ?> to see how the data array is formatted and edit/fix your output code based on that.Regards,
Max
This topic is locked and no more replies can be posted.
