Display "homepages" data on listing page

3 posts by 2 authors in: Forums > CMS Builder
Last Post: February 1, 2011   (RSS)

Re: [gversion] Display "homepages" data on listing page

Hi,

This code (see above post) appears to actually be working.

However, I'd like to also include some information from another table called "accounts" on the same page (the listing detail page).

I think I need to join the "accounts" table (??) and have tried the following at the top of the page:


<?php

require_once "init.php";

list($listingsRecordRecords, $listingsRecordDetails) = getRecords(array(
'tableName' => 'listings',
'joinTable' => 'homepages','accounts',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$listingsRecord = @$listingsRecordRecords[0];


if (!$listingsRecord) { print "listingsRecord not found!"; exit; }

?>



The code I am using to try and insert the data from the accounts table is as follows:


<?php echo $listingsRecord['accounts.first_name'] ?>">
<?php echo $listingsRecord['accounts.last_name'] ?>">
<?php echo $listingsRecord['accounts.email'] ?>" />



However this is not working...

I'd be very grateful if someone could offer some help with this.

Thank you,
Greg

Re: [gversion] Display "homepages" data on listing page

By Jason - February 1, 2011

Hi,

By default, getRecords will take care of a join to the accounts table for you, based on the createdByUserNum field.

for example, if you wanted the email from the account that created the record:

<?php echo $listingsRecord['createdBy.email'];?>

Greg, how are your homepages records and listings records being joined? If you use this code:

<?php showme($listingsRecord);?>

You'll be able to see everything that's being returned in your query. Is it returning what you expect?

Let me know.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/