<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PHP Header Include – Saving development time</title>
	<atom:link href="http://nickduncan.co.za/php-header-include-%e2%80%93-saving-development-time/feed/" rel="self" type="application/rss+xml" />
	<link>http://nickduncan.co.za/php-header-include-%e2%80%93-saving-development-time/</link>
	<description>The online marketing go-to guy</description>
	<lastBuildDate>Sun, 22 Jan 2012 14:08:23 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Anton</title>
		<link>http://nickduncan.co.za/php-header-include-%e2%80%93-saving-development-time/comment-page-1/#comment-1425</link>
		<dc:creator>Anton</dc:creator>
		<pubDate>Wed, 09 Nov 2011 22:00:26 +0000</pubDate>
		<guid isPermaLink="false">http://nickduncan.co.za/?p=16#comment-1425</guid>
		<description>Thanks man! Been looking for this for a LONG time! </description>
		<content:encoded><![CDATA[<p>Thanks man! Been looking for this for a LONG time! </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Devsta</title>
		<link>http://nickduncan.co.za/php-header-include-%e2%80%93-saving-development-time/comment-page-1/#comment-6</link>
		<dc:creator>Devsta</dc:creator>
		<pubDate>Thu, 19 Nov 2009 08:09:28 +0000</pubDate>
		<guid isPermaLink="false">http://nickduncan.co.za/?p=16#comment-6</guid>
		<description>A More versatile Method for dynamic content:

You have to use sessions

header.php:
------------
&lt;pre lang=&quot;php&quot;&gt;
&lt;title&gt;
&lt;?php 

if (isset($_SESSION[&quot;title&quot;]) &amp;&amp; trim($_SESSION[&quot;title&quot;]) != &quot;&quot;) 
{   
 echo $_SESSION[&quot;title&quot;]; 
} 
else 
 echo &quot;My Default Title&quot;

?&gt;
&lt;/title&gt;
&lt;meta name=&quot;description&quot; content=&quot;&lt;? 

if (isset($_SESSION[&quot;desctag&quot;])) 
{ 
 echo ($_SESSION[&quot;desctag&quot;]);
 unset($_SESSION[&quot;desctag&quot;]);
} else {
 echo &quot;Default Description&quot;;
}
?&gt;
&lt;/pre&gt;
 
index.php
-------------
&lt;pre lang=&quot;php&quot;&gt;
&lt;?php
ob_start(); 
// Require the body, which will (try to) set a different title for each page 
require(&#039;body.php&#039;); 
$body = ob_get_contents(); 
// End output buffering 
ob_end_clean(); 

ob_start(); 
//require the header file 
require &quot;header.php&quot;;   
$header = ob_get_contents(); 
ob_end_clean(); 

echo $header;

echo $body;
require &quot;footer.php&quot;;
?&gt;
&lt;/pre&gt;
 
Then on any page included set the two session variables
&lt;pre lang=&quot;php&quot;&gt;
&lt;?php
$_SESSION[&#039;title&#039;] = &#039;Hompage of www.site.co.za&#039;;
$_SESSION[&#039;desctag&#039;] = &#039;Description of page goes here&#039;;
?&gt;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>A More versatile Method for dynamic content:</p>
<p>You have to use sessions</p>
<p>header.php:<br />
&#8212;&#8212;&#8212;&#8212;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;title&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> 
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;title&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;title&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>   
 <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;title&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span> 
<span style="color: #b1b100;">else</span> 
 <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;My Default Title&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/title&gt;
&lt;meta name=&quot;description&quot; content=&quot;<span style="color: #000000; font-weight: bold;">&lt;?</span> 
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;desctag&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span> 
 <span style="color: #b1b100;">echo</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;desctag&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;desctag&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Default Description&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p> <br />
index.php<br />
&#8212;&#8212;&#8212;&#8212;-</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #666666; font-style: italic;">// Require the body, which will (try to) set a different title for each page </span>
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'body.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$body</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ob_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #666666; font-style: italic;">// End output buffering </span>
<span style="color: #990000;">ob_end_clean</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #666666; font-style: italic;">//require the header file </span>
<span style="color: #b1b100;">require</span> <span style="color: #0000ff;">&quot;header.php&quot;</span><span style="color: #339933;">;</span>   
<span style="color: #000088;">$header</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ob_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #990000;">ob_end_clean</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$header</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$body</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require</span> <span style="color: #0000ff;">&quot;footer.php&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p> <br />
Then on any page included set the two session variables</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'title'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Hompage of www.site.co.za'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'desctag'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Description of page goes here'</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Arné</title>
		<link>http://nickduncan.co.za/php-header-include-%e2%80%93-saving-development-time/comment-page-1/#comment-5</link>
		<dc:creator>Arné</dc:creator>
		<pubDate>Thu, 19 Nov 2009 06:50:45 +0000</pubDate>
		<guid isPermaLink="false">http://nickduncan.co.za/?p=16#comment-5</guid>
		<description>This works well enough for simple sites.

I prefer using templates, or template engines like Smarty to handle this for me.  You setup your template with different areas and push your content into the correct areas.

I found that the engine performances are very good and you rarely even need to tweak.</description>
		<content:encoded><![CDATA[<p>This works well enough for simple sites.</p>
<p>I prefer using templates, or template engines like Smarty to handle this for me.  You setup your template with different areas and push your content into the correct areas.</p>
<p>I found that the engine performances are very good and you rarely even need to tweak.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Relic Viper</title>
		<link>http://nickduncan.co.za/php-header-include-%e2%80%93-saving-development-time/comment-page-1/#comment-4</link>
		<dc:creator>Relic Viper</dc:creator>
		<pubDate>Thu, 19 Nov 2009 05:47:20 +0000</pubDate>
		<guid isPermaLink="false">http://nickduncan.co.za/?p=16#comment-4</guid>
		<description>This is a great way to speed up the maintenance on sites. And its extremely easy for any designer to make use of.
here is another way that you can make use of it.
&lt;pre lang=&quot;php&quot;&gt;
&lt;?php
$array = array(
 &quot;index.php&quot;         =&gt; &quot;Home page title&quot;,
 &quot;contact_us.php&quot;     =&gt; &quot;Contact us&quot;,
 &quot;products.php&quot;     =&gt; &quot;Products Page&quot;,
 &quot;about_us.php&quot;     =&gt; &quot;About us&quot;
);
?&gt;

&lt;title&gt;&lt;?php echo $array[$cpage]; ?&gt;&lt;/title&gt;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>This is a great way to speed up the maintenance on sites. And its extremely easy for any designer to make use of.<br />
here is another way that you can make use of it.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
 <span style="color: #0000ff;">&quot;index.php&quot;</span>         <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Home page title&quot;</span><span style="color: #339933;">,</span>
 <span style="color: #0000ff;">&quot;contact_us.php&quot;</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Contact us&quot;</span><span style="color: #339933;">,</span>
 <span style="color: #0000ff;">&quot;products.php&quot;</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Products Page&quot;</span><span style="color: #339933;">,</span>
 <span style="color: #0000ff;">&quot;about_us.php&quot;</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;About us&quot;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;title&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$array</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$cpage</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/title&gt;</pre></div></div>

]]></content:encoded>
	</item>
</channel>
</rss>

