<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Michael Richard Murphy &#187; PHP</title>
	<atom:link href="http://www.letsgomurphys.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.letsgomurphys.com</link>
	<description>making the web work for you</description>
	<lastBuildDate>Fri, 05 Feb 2010 01:22:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Dreamweaver templates giving you nightmares?  Try this simple PHP templating technique</title>
		<link>http://www.letsgomurphys.com/php/2005/06/dreamweaver-templates-giving-you-nightmares-try-this-simple-php-templating-technique/</link>
		<comments>http://www.letsgomurphys.com/php/2005/06/dreamweaver-templates-giving-you-nightmares-try-this-simple-php-templating-technique/#comments</comments>
		<pubDate>Fri, 17 Jun 2005 19:07:16 +0000</pubDate>
		<dc:creator>Michael R. Murphy</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">/?p=4</guid>
		<description><![CDATA[Making the leap into publishing some useful web-related article is something I&#8217;ve been thinking about a lot lately. For some reason, the use of templates always seems to filter to the top when I&#8217;m bandying these crazy ideas about. Call it coincidence, call it divine providence, call it whatever, but Dave Shea&#8217;s recent article about [...]


Related posts:<ol><li><a href='http://www.letsgomurphys.com/asp/2005/10/asp-templating/' rel='bookmark' title='Permanent Link: ASP &#8220;Templating&#8221;'>ASP &#8220;Templating&#8221;</a></li>
<li><a href='http://www.letsgomurphys.com/food-for-thought/2005/12/2006/' rel='bookmark' title='Permanent Link: 2006'>2006</a></li>
<li><a href='http://www.letsgomurphys.com/general/2005/12/neither-here-nor-there/' rel='bookmark' title='Permanent Link: Neither here nor there'>Neither here nor there</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Making the leap into publishing some useful web-related article is something I&#8217;ve been thinking about a lot lately.  For some reason, the use of templates always seems to filter to the top when I&#8217;m bandying these crazy ideas about.  Call it coincidence, call it divine providence, call it whatever,<br />
but <a href="http://www.mezzoblue.com/archives/2005/06/08/simple_templ/" title="www.mezzoblue.com - Simple Templating">Dave Shea&#8217;s recent article about templates</a> and the responses to it has inspired me to share my own technique.  Without further ado�</p>
<p>In larger sites, templates are a godsend.  Trust me, I maintain over 60 E-Commerce domains.  Dreamweaver has saved me hours of finding and replacing but it&#8217;s quirky.  Ever forget to close a tag while you&#8217;re editing?  I have.  Mine freezes up and I end up opening my trusty text editor and correcting the mistake.  Here&#8217;s a simple PHP technique I&#8217;ve implemented on this site.</p>
<p>Each content page consists of a properly formed HTML document, like so:</p>
<p><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"<br />
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;<br />
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;<br />
&lt;head&gt;<br />
	&lt;title&gt;Dreamweaver templates giving you nightmares?  Try this simple PHP templating technique&lt;/title&gt;<br />
	&lt;link rel="stylesheet" type="text/css" media="all" href="css.css" /&gt;<br />
	&lt;meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /&gt;<br />
	&lt;meta name="keywords" content="here are some keywords" /&gt;<br />
&lt;/head&gt;<br />
&lt;body id="about"&gt;<br />
&lt;?php<br />
        require("header.php");<br />
?&gt;<br />
Some content here...<br />
&lt;?php<br />
	require("footer.php");<br />
?&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</code></p>
<p>I&#8217;ve chosen to keep the DOCTYPE, HEAD tags and such in the page with the content.  That way I can still open and edit it in a <acronym title="What You See Is What You Get">WYSIWYG</acronym> editor without too much whining and complaining.  This also allows me to specifically tailor title, description and keywords to each page, along with specifying a body ID for future styling.</p>
<p>My header will contain the banner image and navigation, the content of header.php looks  like this:</p>
<p><code>&lt;div id="container"&gt;<br />
	&lt;div id="banner"&gt;<br />
		&lt;img src="img/banner.jpg" alt=" " /&gt;<br />
	&lt;/div&gt;</p>
<p>	&lt;ul id="nav"&gt;<br />
		&lt;li id="home"&gt;&lt;a href="index.php"&gt;Home&lt;/a&gt;&lt;/li&gt;<br />
		&lt;li id="about"&gt;&lt;a href="about.php"&gt;About Michael&lt;/a&gt;&lt;/li&gt;<br />
		&lt;li id="resources"&gt;&lt;a href="resources.php"&gt;Web Design Resources&lt;/a&gt;&lt;/li&gt;<br />
		&lt;li id="contact"&gt;&lt;a href="contact.php"&gt;Contact Michael&lt;/a&gt;&lt;/li&gt;<br />
	&lt;/ul&gt;<br />
	&lt;div id="content"&gt;<br />
	&lt;!�begin content area--&gt;</code></p>
<p>Since the header and footer files &#8220;wrap&#8221; around the content area, the container and content DIVs are closed up by footer.php, like so:</p>
<p><code>&lt;!�end content area--&gt;<br />
&lt;/div&gt;<br />
&lt;!�end container--&gt;<br />
&lt;/div&gt;</code></p>
<p>There you have it, Templates for Dummies.  If I add another page that should be in the global navigation, I just open header.php and add it to the list, upload, and presto!</p>
<p>So this is it.  A double milestone.  A first post and a first &#8220;How-To&#8221;.  I&#8217;ll be working to constantly improve the writing and technical quality of these posts but please feel free to critique, comment, or make suggestions.</p>


<p>Related posts:<ol><li><a href='http://www.letsgomurphys.com/asp/2005/10/asp-templating/' rel='bookmark' title='Permanent Link: ASP &#8220;Templating&#8221;'>ASP &#8220;Templating&#8221;</a></li>
<li><a href='http://www.letsgomurphys.com/food-for-thought/2005/12/2006/' rel='bookmark' title='Permanent Link: 2006'>2006</a></li>
<li><a href='http://www.letsgomurphys.com/general/2005/12/neither-here-nor-there/' rel='bookmark' title='Permanent Link: Neither here nor there'>Neither here nor there</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.letsgomurphys.com/php/2005/06/dreamweaver-templates-giving-you-nightmares-try-this-simple-php-templating-technique/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

