2 Replies Latest reply on May 12, 2010 6:46 AM by cesc

    Infor on portal rows in PHP, URGENT!!

    cesc

      Title

      Infor on portal rows in PHP, URGENT!!

      Post

      How do I check with PHP for the number of rows in a portal? Actually I only need to know whether the number of rows is different from 0.

      Is there a mehod for it?

       

      Many thanks!

        • 1. Re: Infor on portal rows in PHP, URGENT!!
          cesc

          OK, I got it myself after a couple of hours,

           

              $gennews=$record->getRelatedSet('gennews');
              $portal_gennews  ='<table border="1">';
              $portal_gennews .='<tr>';
              $portal_gennews .='<th>Eventdate</th>';
              $portal_gennews .='<th>Description</th>';
              $portal_gennews .='</tr>';
              foreach($gennews as $portal_record)
                  {
                  $portal_gennews .='<tr>';
                  $portal_gennews .='<td>' .$portal_record->getField('gennews::eventdate').'</td>';
                  $portal_gennews .='<td>' .$portal_record->getField('gennews::description').'</td>';
                  $portal_gennews .='</tr>';
                  }    
              $portal_gennews .='</table>';

           

           

           

           

          <?php if($gennews != '') {echo $portal_gennews;} ?>

           

          So with $gennews one sets the variable of the related set through the relationship gennews. Then in the HTML part (bottom line) one checks whether $gennews is empty or not.







          • 2. Re: Infor on portal rows in PHP, URGENT!!
            cesc

            Sorry to say it will not work when there are no related records...