I am using these codes so that I can pass the file needed or other attribute through variables but it is not working properly. I don't know what the problem is because the code looks pretty fine to me. Index page does not show any content from header's page.
helper.php
<?php
function render($template, $data = array())
{
$path = $template . ' .$php ';
if(file_exists($path))
{
extract($data);
require($path);
}
}
header.php
<?php require_once('helper.php') ?>
<!doctype html>
<head>
<title><?php echo htmlspecialchars($title); ?></title>
</head>
<body>
Index.php
<?php
require_once('helper.php');
render('header', array('title' => 'Index'));
?>
' .$php '. Unless you really have a space before the extension.and a$beforephp, but that seems unlikely.