PHP issue with getRelatedObjects()
Posted: Thu Mar 15, 2012 9:58 am
I have the following code as part of a printable report:
The above code works fine and as desired.
However, when I try to add another getRelatedObjects(), I get an unepected T_STRING Parse error.
The error points to this line:
I can't figure out what I am doing wrong. Any help would be appreciated.
Thanks!
- Code: Select all
<?php
class actions_printable_report {
function handle(&$params){
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
if ( $query['-table'] != 'GENERAL' ){
return PEAR::raiseError('This action can only be called on the Listing table.');
}
$GENERAL = df_get_records_array('GENERAL', $query);
echo '<html><head>'
.'<title>BWA Report v1.0</title>'
.'<style type="text/css">'
.' th { font-size: 75%;}'
.' td { font-size: 75%;}'
.' img { width:170px;
height:170px;
border-style:ridge}'
.' img.logo { width:75%;
height:100%;
border:none }'
.'</style>'
.'</head>'
.'<body>';
foreach ($GENERAL as $record){
$Address = $record->htmlValue('StreetNo').' '.$record->htmlValue('StreetName').' '.$record->htmlValue('City').', '.$record->htmlValue('State').' '.$record->htmlValue('Zip');
$Area = $record->htmlValue('Area1').':'.$record->htmlValue('Area2').':'.$record->htmlValue('Area3').':'.$record->htmlValue('Area4');
$childrenTMLS = $record->getRelatedRecordObjects('MLS');
foreach ($childrenTMLS as $childTMLS){
$childProvider = $childTMLS->htmlValue('Provider');
$childMLS = $childTMLS->htmlValue('MLS');
$childPDF = $childTMLS->val('PDF');
}
The above code works fine and as desired.
However, when I try to add another getRelatedObjects(), I get an unepected T_STRING Parse error.
- Code: Select all
//
foreach ($GENERAL as $record){
$Address = $record->htmlValue('StreetNo').' '.$record->htmlValue('StreetName').' '.$record->htmlValue('City').', '.$record->htmlValue('State').' '.$record->htmlValue('Zip');
$Area = $record->htmlValue('Area1').':'.$record->htmlValue('Area2').':'.$record->htmlValue('Area3').':'.$record->htmlValue('Area4');
$childrenTMLS = $record->getRelatedRecordObjects('MLS');
foreach ($childrenTMLS as $childTMLS){
$childProvider = $childTMLS->htmlValue('Provider');
$childMLS = $childTMLS->htmlValue('MLS');
$childPDF = $childTMLS->val('PDF');
}
$childrenTLS = $record->getRelatedRecordObjects('Living_Structure');
foreach ($childrenTLS as $childTLS){
$childBedroomCt = $childTLS->htmlValue('BedroomCt');
$childBathroomCt = $childTLS->htmlValue('BathroomCt');
$childYearBuilt = $childTLS->htmlValue('YearBuilt');
$childStories = $childTLS->htmlValue('Stories');
$childLivingArea = $childTLS->htmlValue('LivingArea');
$childAttached = $childTLS->htmlValue('Attached');
$childDetached = $childTLS->htmlValue('Detached');
}
echo
//
The error points to this line:
- Code: Select all
foreach ($childrenTLS as $childTLS){
I can't figure out what I am doing wrong. Any help would be appreciated.
Thanks!