Pulling _link from list in different multi record.

4 posts by 2 authors in: Forums > CMS Builder
Last Post: November 30, 2009   (RSS)

By (Deleted User) - November 29, 2009

Hello, I have a multi record and in that i have a pulldown list, it gets it's options from the database and from a different multi record called guided_tour.

OK, the multi record in question is a page where the client can add references about the tour. You know the sort 'I went on this this tour and it was....'

In the multi record edit screen the client can select which tour the ref is from.

The problem is displaying the url to the tour in the displayed page.

I have this in the head:
list($referencesRecords, $referencesMetaData) = getRecords(array(
'tableName' => 'references',
'loadUploads' => '0',));
list($listing_pagesRecords, $listing_pagesMetaData) = getRecords(array(
'tableName' => 'listing_pages',
'loadUploads' => '0',
'where' => "num='11'",));
list($guided_tourRecords, $guided_toursMetaData) = getRecords(array(
'tableName' => 'guided_tour', ));
beta_lookupRelatedFields(array(
'table' => 'guided_tour',
'recordList' => &$guided_tourRecords,
'fieldList' => array( '_link' )
));

Then in the page have this:
<?php foreach ($referencesRecords as $record): ?><?php foreach ($guided_tourRecords as $grecord): ?>
<div class="quote"><span class="bqstart">“</span><?php echo $record['quote'] ?><br/>
<span class="ref-name"><span class="blue"><?php echo $record['name'] ?></span>
<?php if (!$record['website']&& !$record['company']): ?><?php else: ?>
<?php if (!$record['website']): ?> from <?php echo $record['company'] ?><?php else: ?> from <a href="<?php echo $record['website'] ?>" rel="nofollow" title="<?php echo $record['company'] ?>"><?php echo $record['company'] ?></a>
<?php endif ?><?php endif ?>
<?php if (!$record['quote_tour']): ?><?php else: ?>who went on <a href="<?php echo $grecord['_link'] ?>" rel="bookmark" title="<?php echo $record['quote_tour'] ?>"><?php echo $record['quote_tour'] ?></a><?php endif ?>


It pulls the tour title through ok and displays that but I just can't get the _link url to work and link to the tour

Any ideas?

Thanks Jono

Re: [jonoc73] Pulling _link from list in different multi record.

By Chris - November 30, 2009

Hi Jono,

I'm having trouble figuring out exactly what you're trying to accomplish. Your beta_lookupRelatedFields call doesn't make a whole lot of sense, since the '_link' psuedofield is not a list field. It should be throwing an error.
All the best,
Chris

Re: [jonoc73] Pulling _link from list in different multi record.

By Chris - November 30, 2009

Hi Jono,

I'm not sure exaclty how you have things set up, but perhaps you can try:

beta_lookupRelatedFields(array(
'table' => 'guided_tour',
'recordList' => &$guided_tourRecords,
'fieldList' => array( 'quote_tour' )
));


and:

<?php if ($record['quote_tour']): ?>who went on <a href="<?php echo $record['quote_tour']['_link'] ?>" rel="bookmark" title="<?php echo $record['quote_tour']['title'] ?>"><?php echo $record['quote_tour']['title'] ?></a><?php endif ?>

Does that help?
All the best,
Chris