How do I reference joined table field?

JeffP 14 Aug, 2012
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.

<?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.
JeffP 16 Aug, 2012
Anybody have any clue on this one? It really has me stumped.๐Ÿคจ ๐Ÿ˜Ÿ
GreyHead 16 Aug, 2012
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
JeffP 16 Aug, 2012
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?
Max_admin 26 Aug, 2012
Hi Jeff,

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
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.