Demo: include_file, include PHP / HTML file

Welcome to Demo: include_file, include PHP / HTML file into pTemplate

$var_title of included page
include_file_php.php'; echo $included_file_content;?>

[=PTEMPLATE_MARKUP_KEPT_HERE=]


The End
Assign:

INCLUDED_PAGE_TITLE




												


/*
* @ index.php
*/
include_once( 'includes/pTemplate.php' );

// PHP to process things of Index page here
$page_title = 'Demo: parse_file, with default parameters';
$page_content = 'Welcome to Demo: parse_file, with default parameters';

$included_file_title = '$var_title of included page';

$pTemplate->assign_vars(array(
	'PAGE_TITLE'	=> $page_title,
	'PAGE_CONTENT'	=> $page_content,
	'INCLUDED_PAGE_CONTENT'	=> $pTemplate->include_file('include_file_php.php', false, true) // keep global markups
));

$pTemplate->add_file( 'templates/include_file_php.html' );
$output = $pTemplate->pparse_file( 'templates/include_file_php.html' );

echo $output;
exit;
												


/*
* @ include_file_php.php
*/

<?php global $included_file_title; echo $included_file_title;?>
<? $included_file_content = 'some HTML markups processed in include_file_php.php'; echo $included_file_content;?>

[=PTEMPLATE_MARKUP_KEPT_HERE=]

Other demos

View Online Documentation