Faux template issue
<p>I have a problem with dividing site parts to different files so it's easier to edit, but I am having some problems.. the site doesn't work..</p>

<p>This is the original part which works:</p>

<pre><code>&lt;?php if($_SERVER["HTTP_X_PJAX"]): ?&gt;
&lt;div id="main"&gt;first change&lt;/div&gt;
&lt;?php else: ?&gt;
&lt;html&gt;
&lt;head&gt;
&lt;script src="http://pjax.heroku.com/jquery.js"&gt;&lt;/script&gt;
&lt;script src="http://pjax.heroku.com/jquery.cookie.js"&gt;&lt;/script&gt;
&lt;script src="http://pjax.heroku.com/jquery.pjax.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
$(function() { $('a').pjax('#main');
$('#main').bind('pjax:start', function(){$('#main').animate({ height: 'hide', opacity:                    'hide' }, 'fast')})
.bind('pjax:end', function(){$('#main').animate({ height: 'show', opacity: 'show' },   'slow')}); });
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?php
$header = "this is first part
&lt;br/&gt; &lt;a href='test2.php' data-pjax='main'&gt;GO&lt;/a&gt;";
$date = date("Y-m-d H:i:s");
$footer = "this is first part";
echo "$header&lt;br/&gt;$date&lt;br /&gt;&lt;div id='main'&gt;first page&lt;/div&gt;&lt;br /&gt;$footer";
?&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;?php endif; ?&gt;
</code></pre>

<p>This is what I have now, but it doesn't work:</p>

<pre><code>&lt;?php $body = "&lt;div id='main'&gt;first page&lt;/div&gt;&lt;br /&gt;&lt;a href='pjax2.php' data-pjax='main'&gt;GO BACK&lt;/a&gt;"; ?&gt;

&lt;?php if($_SERVER["HTTP_X_PJAX"]): ?&gt;
&lt;?php echo "$body";?&gt;
&lt;?php else: ?&gt;&lt;?php include "header.php";?&gt;
&lt;?php echo "$body"; ?&gt;&lt;?php include "footer.php" ;&gt;
&lt;?php endif; ?&gt;
</code></pre>

<p>Header.php is this:</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;script src="http://pjax.heroku.com/jquery.js"&gt;&lt;/script&gt;
&lt;script src="http://pjax.heroku.com/jquery.cookie.js"&gt;&lt;/script&gt;
&lt;script src="http://pjax.heroku.com/jquery.pjax.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
$(function() { $('a').pjax('#main');
$('#main').bind('pjax:start', function(){$('#main').animate({ height: 'hide', opacity:     'hide' }, 'fast')})
.bind('pjax:end', function(){$('#main').animate({ height: 'show', opacity: 'show' },     'slow')}); });
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
</code></pre>

<p>Footer.php is this:</p>

<pre><code>&lt;/body&gt;&lt;/html&gt;
</code></pre>
