Demo: Section auto show if data-set is avaiable

Welcome to Demo: Section auto show if data-set is avaiable

Footer


The End
Control

include_once( 'includes/pTemplate.php' );

$socials = array(
    array(
        'name'  => 'Facebook',
        'icon'  => 'icon-facebook',
        'url'   => 'https://www.facebook.com/pages/PREscriptZ/1385919551647196',
        'title' => 'Like us',
        'text'  => 'Like us to get chance for 80% DISCOUNT'),
    array(
        'name'  => 'Twitter',
        'icon'  => 'icon-twitter',
        'url'   => 'https://twitter.com/PremiumScript',
        'title' => 'Follow us',
        'text'  => 'Follow us to get chance for 80% DISCOUNT'),
    array(
        'name'  => 'Google+',
        'icon'  => 'icon-google-plus',
        'url'   => 'https://plus.google.com/b/107963842839238880696/107963842839238880696/posts',
        'title' => 'Plus now',
        'text'  => 'Plus now to get chance for 80% DISCOUNT'),
);
  
foreach( $socials as $social ) {
    $pTemplate->assign_block_vars('social_list', array(
        'NAME' => $social['name'],
        'ICON' => $social['icon'],
        'URL'  => $social['url'],
        'TITLE'=> $social['title'],
        'TEXT' => $social['text'],
    ));
}
// do not MUST set $social_list = true
$pTemplate->add_file( 'templates/section_auto_show.html' );
$output = $pTemplate->pparse_file( 'templates/section_auto_show.html' );
 
echo $output;
exit;
Footer
<!-- START_SECTION social_list -->
<ul class="unstyled">
	<!-- BEGIN_LOOP social_list -->
	<li class="inline-block">
		<a href="[=social_list.URL=]" title="[=social_list.TITLE=]">
			<i class="[=social_list.ICON=] largest"></i>
		</a>
	</li>
	<!-- END_LOOP social_list -->
</ul>
<!-- STOP_SECTION social_list -->

Other demos

View Online Documentation