<?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/"
	>

<channel>
	<title>Wythagy</title>
	<atom:link href="http://www.wythagy.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wythagy.com</link>
	<description>Creative Design</description>
	<pubDate>Thu, 19 Feb 2009 23:05:51 +0000</pubDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Now Offering Google Apps</title>
		<link>http://www.wythagy.com/2009/02/now-offering-google-apps/</link>
		<comments>http://www.wythagy.com/2009/02/now-offering-google-apps/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 21:52:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.wythagy.com/?p=153</guid>
		<description><![CDATA[We are very happy to now offer Google Apps to all of our client! Google Apps provide world-class messaging services (based on the powerful GMail platform) and collaboration services through the award-winning Google Docs.  Imagine being able to share an excel sheet with all of your employees online with instantaneous updating and editing shown [...]]]></description>
			<content:encoded><![CDATA[<p>We are very happy to now offer Google Apps to all of our client! Google Apps provide world-class messaging services (based on the powerful GMail platform) and collaboration services through the award-winning Google Docs.  Imagine being able to share an excel sheet with all of your employees online with instantaneous updating and editing shown to every user in your group!  With Google Docs and Google Apps, this is not only doable, it&#8217;s easy!</p>
<p>With the GMail platform, you can now manage your company&#8217;s email services via the online interface that uses the powerful Google Search Engine.  Easily sort, search, and organize emails in a friendly online environment available anywhere around the world on any computer that has internet access!  It&#8217;s secure and simple.</p>
<p><a href="/contact/" title="Contact Wythagy Today">Contact us</a> today and us about how Google Apps and Google Docs can help your business!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wythagy.com/2009/02/now-offering-google-apps/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New Website Layout</title>
		<link>http://www.wythagy.com/2009/01/new-website-layout/</link>
		<comments>http://www.wythagy.com/2009/01/new-website-layout/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 03:37:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.wythagy.com/?p=149</guid>
		<description><![CDATA[If you have been to our website before, you will notice that we have a completely new website layout based on the extremely powerful and flexible WordPress system.  Our new website features a more "web 2.0" aesthetic, better Search Engine Optimization, improved usability and scalability, as well as an all new and improved tutorials section.  In addition, our website...]]></description>
			<content:encoded><![CDATA[<p>If you have been to our website before, you will notice that we have a completely new website layout based on the extremely powerful and flexible WordPress system.  Our new website features a more &#8220;web 2.0&#8243; aesthetic, better Search Engine Optimization, improved usability and scalability, as well as an all new and improved tutorials section.  In addition, our website has been better formatted to be shown on mobile browsers such as Windows Mobile, the Apple iPhone, etc.</p>
<p>As always, we welcome any comments you may have and by all means, please let us know if you discover any problems, broken links, or other web-related issues by <a title="Contact Wythagy" href="/contact/" target="_self">contacting us at anytime</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wythagy.com/2009/01/new-website-layout/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dynamic Titles with PHP</title>
		<link>http://www.wythagy.com/2009/01/dynamic-titles-with-php/</link>
		<comments>http://www.wythagy.com/2009/01/dynamic-titles-with-php/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 03:11:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[Web Design]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.wythagy.com/?p=146</guid>
		<description><![CDATA[Learn how to create dynamic titles via PHP for each of your web pages using a simple snippet of code.  This is vital to ensure proper and effective Search Engine Optimization (SEO).]]></description>
			<content:encoded><![CDATA[<p>We have received quite a few requests after our posting on <a title="Dynamic Web Site Basics in PHP" href="/2009/01/dynamic-web-site-basics-in-php/" target="_self">Dynamic Web Site Basics in PHP</a> on various other dynamic uses of PHP, one main request being the use of dynamic title generation.  Dynamic title generation uses PHP to produce unique titles for each page within your website, which is necessary to maintain optimum Search Engine Optimization (SEO).</p>
<p>We will make the assumption that you have taken the tutorial on Dynamic Web Site Basics in PHP.  If you have a strong grasp on that tutorial, creating dynamic titles will be a breeze for you.  We will be using our same template file, index.php, that we made in the previous tutorial with the same footer.php and header.php external files.  To create dynamic titles, you will need to have index.php and header.php ready.</p>
<h2>Initializing the Title Variable</h2>
<p>The first step is creating a variable within PHP that will allow us to pass along information to the header.php file that contains our <code>&lt;title&gt;</code> and <code>&lt;/title&gt;</code> tags.  Because this variable is page specific, we will put that variable in our index.php file.  The code should look something like this (including our previous PHP code to include the header.php file):</p>
<blockquote><p><code>&lt;?php</code></p>
<p>$title = &#8216;Your Title&#8217;;<br />
$head = $_SERVER['DOCUMENT_ROOT'] . &#8216;/path-to-file/header.php&#8217;;<br />
require $head;</p>
<p>?&gt;</p></blockquote>
<p>You can now replace Your Title with an appropriate title for each page you make.  We will pass this variable along to our header.php file.  NOTE: Be sure to initialize your title variable <strong>before</strong> you call the header.php file.</p>
<h2>Pass The Variable to Header.php</h2>
<p>Now that we have defined our variable in index.php, we need to pass that variable to our <code>&lt;title&gt;&lt;/title&gt;</code> tags.  This requires a simple PHP script within those tags that looks like this:</p>
<blockquote><p><code>&lt;head&gt;<br />
&lt;title&gt;<strong>&lt;?php echo $title; ?&gt;</strong>&lt;/title&gt;</code></p></blockquote>
<p>The PHP code above simply tells the browser to put the contents of our variable $title in between our title tags.</p>
<h2>Conclusion</h2>
<p>With these two simple additions, we can now use index.php as a template, replacing the contents of $title with whatever we desire on each unique page.  With the addition of that simple PHP line in header.php, you don&#8217;t need to touch that file again in reference to making a title.</p>
<h3>Tip</h3>
<p>This same exact technique can be used with your Meta tags such as your description tag, which should also have unique content relative to it&#8217;s page to ensure proper Search Engine Optimization.  Simply initialize a variable, place it before your call to header.php and place a code similar to the one above in your meta tags:</p>
<blockquote><p><code>&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;&lt;?php echo $title; ?&gt;&lt;/title&gt;<br />
&lt;meta name="description" content="<strong>&lt;?php echo $metaDescription; ?&gt;</strong>&#8221; /&gt;</code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.wythagy.com/2009/01/dynamic-titles-with-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dynamic Web Site Basics in PHP</title>
		<link>http://www.wythagy.com/2009/01/dynamic-web-site-basics-in-php/</link>
		<comments>http://www.wythagy.com/2009/01/dynamic-web-site-basics-in-php/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 23:09:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[Web Design]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.wythagy.com/?p=126</guid>
		<description><![CDATA[This tutorial covers some of the basics of creating dynamic websites via PHP and HTML.  Creating websites via PHP is not only a great way to design efficiently, but it makes 100% sense if you ever plan on updating your website (or if you have to hand it off to another design firm).]]></description>
			<content:encoded><![CDATA[<p>This tutorial covers some of the <strong>basics</strong> of creating dynamic websites via PHP and HTML.  Creating websites via PHP is not only a great way to design efficiently, but it makes 100% sense if you ever plan on updating your website (or if you have to hand it off to another design firm).  Simply put, dynamic websites are scalable, usable, and efficient.</p>
<h2>Basic Structure</h2>
<p>All dynamic websites should follow a basic structure.  The more detailed you get and the more parts you add to this structure, the more control you have over your final product.  With that said, your website&#8217;s pages should follow this basic structure:</p>

<a href="http://www.wythagy.com/wp-content/gallery/internal/sitephplayout.jpg" title="" class="shutterset_singlepic46" >
	<img class="ngg-singlepic" src="http://www.wythagy.com/wp-content/gallery/cache/46__x_sitephplayout.jpg" alt="sitephplayout.jpg" title="sitephplayout.jpg" />
</a>

<p>Say we are making our home page called &#8220;index.php.&#8221;  In this example, <em>File 1</em> (as noted in the graphic above) would represent &#8220;index.php&#8221; - in other words, it would be our shell page that will contain the other parts of the page.  <em>File 2</em> above represents our header which would contain the most common elements that are needed on the top of every page, most notably, everything within the &lt;head&gt; and &lt;/head&gt; tags.  The black section named <em>content</em> represents the content native only to that file, meaning it would be page content that only applies to that one page and would not be used in other pages (note: <em>content</em> is <strong>not</strong> being brought in dynamically, it is actually a part of <em>File 1</em>).   Finally, <em>File 3</em> represents the common footer content we want to bring in dynamically in every page from an external file.</p>
<h2>The Advantage of This Structure</h2>
<p>So why use the above structure? Imagine you have made a website with 25 static web pages, all of which contain your website&#8217;s navigation, included scripts, styles, as well as a footer with navigation, privacy links, copyrights, etc.  In one month you find yourself needing to add a new section to the site.  Without the use of dynamic PHP integration, you are forced to edit each single file, that is 25 files.  Had you put the header and footer in separate files and included them dynamically, you would only need to edit two page.</p>
<h2>How We Do It</h2>
<p>When starting from scratch, your best bet is to develop one complete page in the text-editor of your choosing.  When you have settled on a complete design that you are happy with, you can begin the process of breaking that page up.  We will continue to use our example above and break away two files from within our index.php file (File 1).</p>
<h3>File 2 (Header.php)</h3>
<p>Begin by cutting out all content from <code>&lt;html&gt;</code> until the last element prior to your <code>&lt;/head&gt;</code> tag (we&#8217;ll explain why later).  Copy that content, open a new <strong>blank</strong> file, and paste those contents in that file.  Ensure you have zero formatting or extraneous code in that page other than the copied contents.  Save this file as <strong>header.php</strong>.</p>
<h3>File 3 (Footer.php)</h3>
<p>Our external footer file, which you should name <strong>footer.php </strong>will contain all information that you want at the bottom of every page.  As done above, copy the desired code and paste in a blank file.  Be sure to keep the final <code>&lt;/body&gt;</code> and <code>&lt;/html&gt;</code> tags within the index.php (File 1) file (again, we&#8217;ll explain why later).</p>
<h3>Final Pages</h3>
<p>Now that you have separated the files, you should have three pages that look like this:</p>

<a href="http://www.wythagy.com/wp-content/gallery/internal/pagesbrokenup.jpg" title="" class="shutterset_singlepic47" >
	<img class="ngg-singlepic" src="http://www.wythagy.com/wp-content/gallery/cache/47__x_pagesbrokenup.jpg" alt="pagesbrokenup.jpg" title="pagesbrokenup.jpg" />
</a>

<h3>Details</h3>
<p>As stated above, we were careful to leave a few select snippets of code in our first index.php file.  We did this to ensure ourselves some flexibility in the future - afterall, that is what this whole process is about.  By keeping the <code>&lt;/head&gt;</code> tag outside of the header.php file, we have given ourselves the ability to selectively include javascripts or styles within the head of the page on individual pages.  Why is this useful?  Say you have a &#8220;gallery&#8221; page, and on that page you have some type of fancy image gallery using a library like Jquery.  Due to the size of the Jquery file we may not want to include it on every page, especially since only one page needs it (including it affects load time).  Now, on our gallery page, we can simply include the <code>&lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;</code> directly on our root page before the <code>&lt;/head&gt;</code> code.</p>
<p>The same thought process goes into the footer and leaving the <code>&lt;/body&gt;</code> and <code>&lt;/html&gt;</code> lines of code in the source file.  This now gives you options to independently include unique content in select files under, or within, that footer.</p>
<h2>The PHP</h2>
<p>You are just about done and on your way to a dynamic, PHP driven website.  With the files properly separated, all that is left to do is to include the &#8220;pieces&#8221; in the root file (File 1 - index.php) via a simple PHP script for each file.  Each PHP snippet will contain two items - a variable and a <code>require</code> call in between <code>&lt;?php</code> and <code>?&gt;</code> which tell the web browser the code should be rendered server-side in PHP.  For both header.php, and footer.php, the code should look like the following:</p>
<blockquote><p><code>&lt;?php</code></p>
<p>$head = $_SERVER['DOCUMENT_ROOT'] . &#8216;/path-to-file/<strong>header.php</strong>&#8216;;</p>
<p>require $head;</p>
<p>?&gt;</p></blockquote>
<h3>Explanation</h3>
<p>In order to tell our server where the file is we need to grab, we must first define a variable (an identifier that contains information) with the correct location of that file.  The <code>$_SERVER['DOCUMENT_ROOT']</code> code tells our server to grab the root path of our server (this often looks like<code> /c3/w/_public/www/</code> or some other obscure path) and then append it to the relative location of the file (the folder you have the header.php file contained in).  Finally, the line <code>require $head;</code> tells the server that variable is <strong>required </strong>to run the page (as opposed to calls like <code>include</code>).</p>
<p>Simply copy the same script and change the ending file name to <strong>footer.php</strong> and change the variable to something differnt (i.e. <code>$footer</code>) and you should have a finished page that looks something similar to:</p>

<a href="http://www.wythagy.com/wp-content/gallery/internal/finalphppage.jpg" title="" class="shutterset_singlepic48" >
	<img class="ngg-singlepic" src="http://www.wythagy.com/wp-content/gallery/cache/48__x_finalphppage.jpg" alt="finalphppage.jpg" title="finalphppage.jpg" />
</a>

<h2>Conclusion</h2>
<p>Bare in mind that the above tutorial is conceptual and definitely does not reflect the extent of which PHP can be used to create a dynamic website.  However, by understanding these basic principles, you can now begin to explore PHP more to learn how you can create a dynamic and scalable website, and in the very least you will have yourself a simple website that can be updated in a fraction of the time.</p>
<p><strong>Update</strong>: Learn how to create <a title="Dynamic Titles With PHP" href="/2009/01/dynamic-titles-with-php/" target="_self">Dynamic Titles with PHP</a> following this tutorial.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wythagy.com/2009/01/dynamic-web-site-basics-in-php/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
  
