PHP issue with getRelatedObjects()

A place for users and developers of the Xataface to discuss and receive support.

PHP issue with getRelatedObjects()

Postby wisni1rr » Thu Mar 15, 2012 9:58 am

I have the following code as part of a printable report:
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!
wisni1rr
 
Posts: 107
Joined: Mon Feb 13, 2012 9:03 pm

Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 2 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved