Generating PDF displays variable names and not values.


I think this is probably a simple issue that I have but I’m getting nowhere fast with it. I have a one to many relationship between “record-collection” and “records” (1 record collection has many records). What I want is to do is generate a pdf of the records in my collection. When I try to add the variables to the pdf template I just get the variable names printed to the pdf file.

Also I want to display my list of records in between the buttons on the edit view so I can update any details easily. I’m not sure how to do this.

This is the code for my record collection edit view:


	require_once 'include/MVC/View/views/view.edit.php';

	if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
	class RECOL_Record_CollectionViewEdit extends ViewEdit
	    public function display()

	        $recordCollectionBean = BeanFactory::getBean('RECOL_Record_Collection', $_REQUEST['record']);
			$recordsBeans = $recordCollectionBean->recol_record_collection_recor_records_2->getBeans();

			foreach($recordsBeans as $recordBean){
                               Surely there is a better way to output html
				echo "<br />Name" . $recordBean->name;
				echo "<br />Description: ".$recordBean->description;
				echo "<br />Image: ".$recordBean->image_c;
				echo "<br /><img src=\"upload/".$recordBean->id."_image_c\" />";
				echo "<br /><br />";




I’ve attached a few screenshots to show what I mean.

Any help with this would be much appreciated.