include_once( 'includes/pTemplate.php' ); $friends = array( array( 'Name' => 'Friend Name 1', 'Email' => '[email protected]', 'Address' => 'Friend 1 Address', ), array( 'Name' => 'Friend Name 2', 'Email' => '[email protected]', 'Address' => 'Friend 2 Address', ), array( 'Name' => 'Friend Name 3', 'Email' => '[email protected]', 'Address' => 'Friend 3 Address', ), ); $public_email = isset($_GET['email']) && !empty($_GET['email']) ? true : false; $public_address = isset($_GET['address']) && !empty($_GET['address']) ? true : false; foreach( $friends as $friend ) { $pTemplate->assign_block_vars('friend_list', array( 'NAME' => $friend['Name'], 'EMAIL' => $public_email ? $friend['Email'] : 'Private', 'ADDRESS' => $friend['Address'], 'PUBLIC_EMAIL' => $public_email, 'PRIVATE_EMAIL' => !$public_email, 'PUBLIC_ADDRESS'=> $public_address, )); } $pTemplate->add_file( 'templates/section_in_dataset.html' ); $output = $pTemplate->pparse_file( 'templates/section_in_sections.html' ); $pTemplate->pparse( $output ); echo $output;