include_once( 'includes/pTemplate.php' );
// assign a set of data
// usually data-set fetched from database
$socials = array(
array(
'name' => 'Facebook',
'icon' => 'icon-facebook',
'url' => 'https://www.facebook.com/pages/PREscriptZ/1385919551647196',
'title' => 'Like us'),
array(
'name' => 'Twitter',
'icon' => 'icon-twitter',
'url' => 'https://twitter.com/PremiumScript',
'title' => 'Follow us'),
array(
'name' => 'Google+',
'icon' => 'icon-google-plus',
'url' => 'https://plus.google.com/b/107963842839238880696/107963842839238880696/posts',
'title' => 'Plus now'),
);
foreach( $socials as $social ) {
$pTemplate->assign_block_vars('social_list', array(
'ITEM_NAME' => $social['name'],
'ITEM_ICON' => $social['icon'],
'ITEM_URL' => $social['url'],
'ITEM_TITLE'=> $social['title']
));
}
$pTemplate->add_file( 'templates/assign_block_vars.html' );
$output = $pTemplate->pparse_file( 'templates/assign_block_vars.html' );
$pTemplate->pparse( $output );
echo $output;