Location: PHPKode > scripts > PDFTemplate > pdftemplate/xmlpdf.php
<?php
	include "class.PDFTemplate.php";
  function is_sel($c1,$c2,$v="SELECTED") {
		if ($c1==$c2)
			echo $v;
  }

	function print_form() {
		global $name,$SCRIPT_NAME,$debug;
		?>
	<form action="<?echo $SCRIPT_NAME?>">	
	Name=<input type="text" name="name" value="<?echo $name?>"/><br/>
	Debug=<input type="checkbox" name="debug" value="1" <?is_sel($debug,1,"CHECKED")?>"/> (Prints LOTS of Debugging information)<br/>
	<input type="submit" value="Create PDF"/>
	</form>
<?}

	if (empty($name)||$debug==1) {
		print_form();
	}
	if (!empty($name)) {
		$mypdf = new PDFTemplate("pdf.xml",$debug);

		if ($debug) {
			print "<a href=\"$SCRIPT_NAME?name=$name&debug=0\">View PDF</a><p>\n";
		}

		$mypdf->Assign("NAME",$name);
		$mypdf->AssignBlock("test","VALUE","5");
		$mypdf->AssignBlock("test","DATE",date("F j, Y"));
		$mypdf->NextBlock("test");
		$mypdf->AssignBlock("test",array(
			"VALUE"=>"10",
			"DATE"=>date("M j, Y")
		));

		if (($error=$mypdf->Parse())!=false) {
			print "Error parsing document: $error\n";
		}
		$mypdf->Close();
	}
?>
Return current item: PDFTemplate