Demo: Boolean section in data-set (alternation)

Welcome to Demo: Boolean section in data-set (alternation)

Friend list


The End
Access

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'	=> $public_address ? $friend['Address'] : '',
	));
}
 
$pTemplate->add_file( 'templates/section_in_dataset_alternate.html' );
$output = $pTemplate->pparse_file( 'templates/section_in_dataset_alternate.html' );
 
$pTemplate->pparse( $output );
echo $output;

Other demos

View Online Documentation