Currently i manually call a given code to see wether a content type and filefield are present in current node.
I'd like to do this more than just once (i have the code in there 3 times, which is very sub-optimal) until all fields are parsed
this probably means there needs to be a very basic array and foreach loop to do this. However my php skills do not allow....

Any help would be greatly appreceated!

This is my code:

 <?php  
	$teacher_select= $field_teacher_select[0]['nid'];
	$teacher_select= node_load($teacher_select);
	 
  ?>
  <?php 
   	$teacher_photo=  $field_teacher_photo[0]['nid'];
  ?>
  <div class="workshop_teacher">
  <h2><?php print $teacher_select->title?></h2>
<?php print theme('imagecache', 'Node_Image_thumbnail', $teacher_select->field_teacher_photo[0]['filepath'], $teacher_select->field_teacher_photo[0]['description'],$teacher_select->field_teacher_photo[0]['description']); ?>
  <?php print $teacher_select->teaser ?>
<?php if ($teacher_select): ?><br /><a href="/yoga/node/<?php print $teacher_select->nid ?>/lightbox2" rel="lightframe[width:650px; height: 550px;][<?php print $teacher_select->title ?>]">read more...</a> <?php endif; ?>
</div>

field_teacher_select is a noderefer type cck field
im node_load ing the refered node(s) in a different page and linking to these nodes in a lightframe