<?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>sammela.com &#187; article</title>
	<atom:link href="http://sammela.com/category/article/feed/" rel="self" type="application/rss+xml" />
	<link>http://sammela.com</link>
	<description>Stunning web design articles</description>
	<lastBuildDate>Tue, 17 Nov 2009 04:43:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The OpenCart Controller base class</title>
		<link>http://sammela.com/2009/11/15/the-opencart-controller-base-class/</link>
		<comments>http://sammela.com/2009/11/15/the-opencart-controller-base-class/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 05:00:30 +0000</pubDate>
		<dc:creator>Sam Mela</dc:creator>
				<category><![CDATA[article]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[opencart]]></category>

		<guid isPermaLink="false">http://sammela.com/?p=496</guid>
		<description><![CDATA[All controllers in OpenCart share a common ancestor, the Controller class, located in the  DIR_APPLICATION/system/engine/controller.php file.  Note that DIR_APPLICATION is the path to your application directory, and is defined in the OpenCart config.php file.
In object oriented terms, the Controller class is called a base class.  It contains common methods and data definitions [...]]]></description>
			<content:encoded><![CDATA[<p>All controllers in OpenCart share a common ancestor, the <strong>Controller</strong> class, located in the  DIR_APPLICATION/system/engine/controller.php file.  Note that DIR_APPLICATION is the path to your application directory, and is defined in the OpenCart config.php file.</p>
<p>In object oriented terms, the <strong>Controller</strong> class is called a base class.  It contains common methods and data definitions that all its descendant classes will find useful and can use.  </p>
<p>Data definitions for the <strong>Controller</strong> class follow:</p>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td style="padding-right:10px; padding-bottom:10px; font-weight:bold;" align="left" valign="top">$id;</td>
<td style="padding-bottom:10px;" align="left" valign="top"><strong>$id</strong> is used to identify the controller.  Typically it is set by the controller. For example, the ControllerCommonColumnLeft controller sets its <strong>$id</strong> to &#8220;column_left&#8221;. Controller id&#8217;s are the means by which a parent controller relates child controller output to a template. The name used in the template must match the controller name.</td>
</tr>
<tr>
<td style="padding-right:10px; font-weight:bold;" align="left" valign="top">$template</td>
<td style="padding-bottom:10px;" align="left" valign="top"><strong>$template</strong> is the file that defines the output of the controller. It is basically a PHP/HTML file that is populated with variables from the controller <strong>$data</strong> array.</td>
</tr>
<tr>
<td style="padding-right:10px; font-weight:bold;" align="left" valign="top">$children</td>
<td style="padding-bottom:10px;" align="left" valign="top"><strong>$children</strong> is an array of the controllers that a top level controller is composed of. It is very important to understand that these are not children in the object oriented inheritance sense of the term. They are just pieces of the top level controller, the way tires and the engine are pieces of a car. For example, <strong>ControllerCommonHome</strong> contains the following childres:</p>
<ul>
<li> ControllerCommonHeader</li>
<li>ControllerCommonFooter</li>
<li>ControllerCommonLeft</li>
<li>ControllerCommonRight</li>
</ul>
</td>
</tr>
<tr>
<td style="padding-right:10px; font-weight:bold;" align="left" valign="top">$data</td>
<td style="padding-bottom:10px;" align="left" valign="top">All information that will be used to populate the <strong>$template</strong> is stored in the <strong>$data</strong> array. In the controller <strong>fetch</strong> method, the PHP <strong>extract</strong> function is used to create local variables from the  <strong>$data</strong> array and make them available to populate the <strong>$template</strong>.</td>
</tr>
<tr>
<td style="padding-right:10px; font-weight:bold;" align="left" valign="top">$output</td>
<td style="padding-bottom:10px;" align="left" valign="top">The HTML output of the  <strong>$template</strong> is ultimately stored in the <strong>$output</strong> variable, where it is available to be echoed to the client browser.</td>
</tr>
</table>
<p>In addition to the above class data, the base<strong>Controller</strong> class makes a few methods available.  </p>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td style="padding-right:10px; padding-bottom:10px; font-weight:bold;" align="left" valign="top">__get</td>
<td style="padding-bottom:10px;" align="left" valign="top"><strong>__get</strong> is a magic method that gets a class scope variable from the <strong>Registry</strong> class. See the online PHP documentation on magic methods for more detail. Also see  <a href="2009/11/13/the-open-cart-load-class-variable/" target="_blank">The Open Cart “load” Class Variable and Magic Methods</a>.</td>
</tr>
<tr>
<td style="padding-right:10px; padding-bottom:10px; font-weight:bold;" align="left" valign="top">__set</td>
<td style="padding-bottom:10px;" align="left" valign="top"><strong>__set</strong> is a magic method that puts a class scope variable into the <strong>Registry</strong> class. See the online PHP documentation on magic methods for more detail. Also see <a href="2009/11/13/the-open-cart-load-class-variable/" target="_blank">The Open Cart “load” Class Variable and Magic Methods</a>.</td>
</tr>
<tr>
<td style="padding-right:10px; font-weight:bold;" align="left" valign="top">forward</td>
<td style="padding-bottom:10px;" align="left" valign="top">The <strong>forward</strong> method creates a new instance of the Router class.</td>
</tr>
<tr>
<td style="padding-right:10px; font-weight:bold;" align="left" valign="top">redirect</td>
<td style="padding-bottom:10px;" align="left" valign="top">The <strong>redirect</strong> method immediately redirects to a new location.</td>
</tr>
<tr>
<td style="padding-right:10px; font-weight:bold;" align="left" valign="top">fetch</td>
<td style="padding-bottom:10px;" align="left" valign="top">See <a href="2009/11/14/how-opencart-renders-pages/" target="_blank">How OpenCart Renders Pages</a>.</td>
</tr>
<tr>
<td style="padding-right:10px; font-weight:bold;" align="left" valign="top">render</td>
<td style="padding-bottom:10px;" align="left" valign="top">See <a href="2009/11/14/how-opencart-renders-pages/" target="_blank">How OpenCart Renders Pages</a>.</td>
</tr>
</table>
<p>© 2009, Sam Mela. All rights reserved.</p>
]]></content:encoded>
			<wfw:commentRss>http://sammela.com/2009/11/15/the-opencart-controller-base-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenCart Top Level Controller Architecture</title>
		<link>http://sammela.com/2009/11/14/opencart-top-level-controller-architecture/</link>
		<comments>http://sammela.com/2009/11/14/opencart-top-level-controller-architecture/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 22:54:52 +0000</pubDate>
		<dc:creator>Sam Mela</dc:creator>
				<category><![CDATA[article]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[opencart]]></category>

		<guid isPermaLink="false">http://sammela.com/?p=478</guid>
		<description><![CDATA[An OpenCart top level controller is responsible for orchestrating the complete construction of an OpenCart page.
As an example, the ControllerCheckoutCart controller class is responsible for coordinating the model data and the template view necessary to create a checkout cart page for the client.
Another example is the ControllerCommonHome controller class, which is responsible for the main [...]]]></description>
			<content:encoded><![CDATA[<p>An OpenCart top level controller is responsible for orchestrating the complete construction of an OpenCart page.</p>
<p>As an example, the <strong>ControllerCheckoutCart</strong> controller class is responsible for coordinating the model data and the template view necessary to create a checkout cart page for the client.</p>
<p>Another example is the <strong>ControllerCommonHome</strong> controller class, which is responsible for the main store view that customers see when they first visit.</p>
<h3>Common Base Class</h3>
<p>All controllers in OpenCart share a common ancestor, the <strong>Controller</strong> class, located in the  DIR_APPLICATION/system/engine/controller.php file.  This class is described in <a href="http://sammela.com/2009/11/15/the-opencart-controller-base-class/">The OpenCart Controller Base Class</a></p>
<h3>The Index Method</h3>
<p>© 2009, Sam Mela. All rights reserved.</p>
]]></content:encoded>
			<wfw:commentRss>http://sammela.com/2009/11/14/opencart-top-level-controller-architecture/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How OpenCart Renders Pages</title>
		<link>http://sammela.com/2009/11/14/how-opencart-renders-pages/</link>
		<comments>http://sammela.com/2009/11/14/how-opencart-renders-pages/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 06:01:07 +0000</pubDate>
		<dc:creator>Sam Mela</dc:creator>
				<category><![CDATA[article]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[opencart]]></category>

		<guid isPermaLink="false">http://sammela.com/?p=458</guid>
		<description><![CDATA[The OpenCart Controller class contains a render method that is used to produce HTML pages output by all OpenCart classes that inherit from Controller class.
Here is how it works.
Each time a page is rendered, it is done with one top level controller.  The top level controller may contain zero or more child controllers and [...]]]></description>
			<content:encoded><![CDATA[<p>The OpenCart <strong>Controller</strong> class contains a <strong>render</strong> method that is used to produce HTML pages output by all OpenCart classes that inherit from <strong>Controller</strong> class.</p>
<p>Here is how it works.</p>
<p>Each time a page is rendered, it is done with one top level controller.  The top level controller may contain zero or more child controllers and it contains a template.  Rendering proceed in the following order:</p>
<ol>
<li>Each child controller is rendered</li>
<li>The top level controller is rendered, based on its own data and the output of the child controllers</li>
</ol>
<p>That&#8217;s it.  The rest is details which are described in the remainder of this article.</p>
<h3>How the Template is Rendered</h3>
<p>As stated previously, the top level controller <strong>render</strong> method produces output using a template.  To accomplish this, it passes the template to the <strong>fetch</strong> method, which does the actual work.</p>
<h3>The fetch Method</h3>
<p>As stated previously, the top level controller <strong>render</strong> method produces output using a template.  To accomplish this, it passes the template to the <strong>fetch</strong> method, which does the actual work.</p>
<p>The <strong>fetch</strong> method is not very long, but it does some clever things and it takes advantage of some very powerful features of PHP.  Here is the operative code:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">// Create local variables from the controller data array</span><br />
<a href="http://www.php.net/extract"><span style="color: #990000;">extract</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Initialize PHP output buffering</span><br />
<a href="http://www.php.net/ob_start"><span style="color: #990000;">ob_start</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp;<br />
<br />
<span style="color: #666666; font-style: italic;">// Load the template file, which is automatically </span><br />
<span style="color: #666666; font-style: italic;">// populated with the local variables created above &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><br />
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Get the output of the template file</span><br />
<span style="color: #666666; font-style: italic;">// Which has been echoed to the PHP output buffer</span><br />
<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/ob_get_contents"><span style="color: #990000;">ob_get_contents</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Empty the PHP output buffer</span><br />
<a href="http://www.php.net/ob_end_clean"><span style="color: #990000;">ob_end_clean</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Basically, all information necessary to populate the template must be stored in the controller&#8217;s $data array.  The native PHP extract function pulls the information out the the $data array and populates the local symbol table with it, so it is available to the template file.</p>
<p>Now here is the trick.  The template file echoes its output; but since PHP buffering is turned on, the echoed HTML is not output to the client browser, but rather to the PHP output buffer.  The <strong>fetch</strong> method stores the PHP output buffer contents in the <strong>$content</strong> variable and then returns it to the calling function.  Cool beans.</p>
<p>But there&#8217;s more.  Not only is this method used for the top level controller, but each of the controllers contained by the top level controller (the children) is evaluated the same way; and the children can contain their own children, theoretically without limit, although in practical terms it is unlikely they will go more than two or three levels deep.</p>
<p>© 2009, Sam Mela. All rights reserved.</p>
]]></content:encoded>
			<wfw:commentRss>http://sammela.com/2009/11/14/how-opencart-renders-pages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add Backtrace to the WiPeD WordPress Debugger</title>
		<link>http://sammela.com/2009/10/07/add-backtrace-to-the-wiped-wordpress-debugger/</link>
		<comments>http://sammela.com/2009/10/07/add-backtrace-to-the-wiped-wordpress-debugger/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 01:53:07 +0000</pubDate>
		<dc:creator>Sam Mela</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[article]]></category>

		<guid isPermaLink="false">http://sammela.com/?p=265</guid>
		<description><![CDATA[In a previous article (WiPeD: A Useful WordPress Debugger Plugin), I discussed the WiPeD WordPress Debugger, written by Sterling Camden, which you can read more about on the Chiptips Blog.
I&#8217;ve been educating myself about the structure of WordPress, and recently I found it useful to add some backtrace capability to WiPeD.
What is Backtrace?
Backtrace is the [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous article (<a title="WiPeD: A Useful WordPress Debugger" href="/2009/10/06/wiped-a-useful-wordpress-debugger-plugin/" target="_blank">WiPeD: A Useful WordPress Debugger Plugin</a>), I discussed the WiPeD WordPress Debugger, written by Sterling Camden, which you can read more about on the <a href="http://www.chipstips.com/?p=172">Chiptips Blog</a>.</p>
<p>I&#8217;ve been educating myself about the structure of WordPress, and recently I found it useful to add some backtrace capability to WiPeD.</p>
<h3>What is Backtrace?</h3>
<p>Backtrace is the PHP capability to create an array containing a list of the hierarchical function calls that led to a particular point of execution.</p>
<p>Actually the PHP <strong>debug_backtrace</strong> function produces an array of arrays. For each function in the call hierarchy, it makes available the line number, file name, and function name. But the format isn&#8217;t very use friendly for this application, so the bulk of my backtrace addition is devoted to producing a nice format that fits into the output scheme of the WiPeD debugger.</p>
<h3>How Backtrace Affects WiPeD</h3>
<ol>
<li><strong>Logging</strong> &#8212; the WPD_backtrace is used to perform a backtrace at any point in your code.  Just add a WPD_backtrace(); function call where you want the backtrace data logged.  As a coder/debugger, this is the only modification to your code you will need to make, in order to use this feature.</li>
<li><strong>Output</strong> &#8212; the WiPeD output now includes the results of the logged backtrace calls.</li>
</ol>
<h3>Example of Use</h3>
<p>Here&#8217;s an example of the <strong>WPD_backtrace()</strong> function used in the <strong>main </strong>method of the <strong>WP </strong>object in the <strong>classes.php</strong> file of WordPress.</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> main<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query_args</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; WPD_backtrace<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//ssmela &nbsp; &nbsp; &nbsp; </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">parse_request</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query_args</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">send_headers</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query_posts</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">handle_404</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register_globals</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; do_action_ref_array<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$this</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<h3>File and Code Modifications</h3>
<h5>CSS</h5>
<p>I added a css style file &#8212; wiped.css.  You can change the css in this file to control how the backtrace output looks.</p>
<p>The <strong>WPD_backtrace</strong> class defines the style of the backtrace output data.</p>
<p>The <strong>WPD_tracepoint</strong> class is a specialized class to define the style of the output data at the tracepoint.</p>
<p>You can also modify css tags used by the original author (WPD_output, WPD_message, WPD_text, WPD_element, and WPD_array).</p>
<h5>Additions to WiPeD.php</h5>
<p>Additions to WiPeD.php are marked as &#8220;ssmela addition 1&#8243;, &#8220;ssmela addition 2&#8243;,  and &#8220;ssmela addition 3&#8243;; and they are listed below, along with brief explanations.  Basically, my additions build on the existing general WiPeD logging and display capability, but they add a more specialized backtrace display capability.</p>
<ol>
<li>ssmela addition 1 &#8211;  Sets up to include the wiped.css file</li>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">// Start ssmela addition 1</span><br />
<span style="color: #666666; font-style: italic;">// Set up to include the wiped.css file</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/defined"><span style="color: #990000;">defined</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;WP_CONTENT_URL&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;WP_CONTENT_URL&quot;</span><span style="color: #339933;">,</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;siteurl&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/wp-content&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/defined"><span style="color: #990000;">defined</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;WP_PLUGIN_URL&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> &nbsp;<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;WP_PLUGIN_URL&quot;</span><span style="color: #339933;">,</span> &nbsp;WP_CONTENT_URL &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/plugins&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> wiped_head<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #000088;">$css_url</span> <span style="color: #339933;">=</span> WP_PLUGIN_URL <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/wiped/wiped.css&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/file_exists"><span style="color: #990000;">file_exists</span></a><span style="color: #009900;">&#40;</span>TEMPLATEPATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/wiped.css&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$css_url</span> <span style="color: #339933;">=</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;template_url&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/wiped.css&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;link rel=&quot;stylesheet&quot; href=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$css_url</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;'</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #666666; font-style: italic;">// End ssmela Addition 1</span></div></td></tr></tbody></table></div>
<li>ssmela addition 2 &#8211;  Call the function that includes additional css file, wiped.css</li>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Start ssmela addition 2</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Call the function that includes wiped.css</span><br />
&nbsp; &nbsp; add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wiped_head'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// End ssmela addition 2</span></div></td></tr></tbody></table></div>
<li>ssmela addition 3 &#8211;  Function to add trace data to the WiPeD log</li>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">// Start ssmela addition 3</span><br />
<span style="color: #666666; font-style: italic;">// Function to add trace data to the WiPeD log</span><br />
<span style="color: #000000; font-weight: bold;">function</span> WPD_backtrace<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$trace_array</span> &nbsp; &nbsp;&nbsp; &nbsp; <span style="color: #339933;">=</span> <a href="http://www.php.net/debug_backtrace"><span style="color: #990000;">debug_backtrace</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$trace_array_count</span>&nbsp; <span style="color: #339933;">=</span> <a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$trace_array</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000088;">$callee_line</span> &nbsp; &nbsp;&nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$callee_file</span> &nbsp; &nbsp;&nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$callee_function</span>&nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$caller_line</span> &nbsp; &nbsp;&nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$caller_file</span> &nbsp; &nbsp;&nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #000088;">$trace_array_count</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$trace_element</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$trace_array</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$callee_line</span> &nbsp; &nbsp;&nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #000088;">$caller_line</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$callee_file</span> &nbsp; &nbsp;&nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #000088;">$caller_file</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$callee_function</span>&nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #000088;">$trace_element</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;function&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$caller_line</span> &nbsp; &nbsp;&nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #000088;">$trace_element</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;line&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$caller_file</span> &nbsp; &nbsp;&nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #000088;">$trace_element</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;file&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$call_list</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;&amp;nbsp;&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;Caller file: <span style="color: #006699; font-weight: bold;">$caller_file</span>&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;Caller line: <span style="color: #006699; font-weight: bold;">$caller_line</span>&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;Callee file: <span style="color: #006699; font-weight: bold;">$callee_file</span>&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;Callee line: <span style="color: #006699; font-weight: bold;">$callee_line</span>&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;Callee function: <span style="color: #006699; font-weight: bold;">$callee_function</span>&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;&amp;nbsp;&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000088;">$call_list</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <a href="http://www.php.net/array_reverse"><span style="color: #990000;">array_reverse</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$call_list</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$call_list_count</span>&nbsp; &nbsp; <span style="color: #339933;">=</span> <a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$call_list</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; WPD_print<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;p class=<span style="color: #000099; font-weight: bold;">\&quot;</span>WPD_backtrace<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&lt;code&gt;+++++++++++++++++++++++++++&lt;/code&gt;&lt;/p&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; WPD_print<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;p class=<span style="color: #000099; font-weight: bold;">\&quot;</span>WPD_backtrace<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&lt;code&gt;|||||||||||||||||||||||||||&lt;/code&gt;&lt;/p&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #000088;">$call_list_count</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span> &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$call_list_element</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$call_list</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$call_list_element</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$call_list_element_string</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">!=</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$call_list_count</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WPD_print<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;p class=<span style="color: #000099; font-weight: bold;">\&quot;</span>WPD_backtrace<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$call_list_element_string</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/p&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WPD_print<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;p class=<span style="color: #000099; font-weight: bold;">\&quot;</span>WPD_tracepoint<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$call_list_element_string</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/p&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; WPD_print<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;p class=<span style="color: #000099; font-weight: bold;">\&quot;</span>WPD_backtrace<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&lt;code&gt;|||||||||||||||||||||||||||&lt;/code&gt;&lt;/p&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; WPD_print<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;p class=<span style="color: #000099; font-weight: bold;">\&quot;</span>WPD_backtrace<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&lt;code&gt;+++++++++++++++++++++++++++&lt;/code&gt;&lt;/p&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #666666; font-style: italic;">// End ssmela addition 3</span></div></td></tr></tbody></table></div>
</ol>
<h3>Output</h3>
<p>The output looks like the following.  Towards the bottom of the output listing, note the red text color, which denotes the point in the code where the trace is actually called.  The entries above the red are preceding code points in the call tree.  The entries below the red is the actual trace code function, and could be removed in the future.  </p>
<ol>
<div style="height:300px; max-width:450px; background-color:#ececec; padding:10px; border:1px black solid; overflow:scroll">
<p style="margin-top: 0px; margin-bottom: 0px; font-family:Courier, monospace;">+++++++++++++++++++++++++++</p>
<p style="margin-top: 0px; margin-bottom: 0px;  font-family:Courier, monospace;">|||||||||||||||||||||||||||</p>
<p style="margin-top: 0px; margin-bottom: 0px;">&nbsp;</p>
<p style="margin-top: 0px; margin-bottom: 0px;">Caller file: /home/sammela/public_html/index.php</p>
<p style="margin-top: 0px; margin-bottom: 0px;">Caller line: 17</p>
<p style="margin-top: 0px; margin-bottom: 0px;">Callee file:   /home/sammela/public_html/wp-blog-header.php</p>
<p style="margin-top: 0px; margin-bottom: 0px;">Callee line: 16</p>
<p style="margin-top: 0px; margin-bottom: 0px;">Callee function: require</p>
<p style="margin-top: 0px; margin-bottom: 0px;">&nbsp;</p>
<p style="margin-top: 0px; margin-bottom: 0px;">&nbsp;</p>
<p style="margin-top: 0px; margin-bottom: 0px;">Caller file:   /home/sammela/public_html/wp-blog-header.php</p>
<p style="margin-top: 0px; margin-bottom: 0px;">Caller line: 16</p>
<p style="margin-top: 0px; margin-bottom: 0px;">Callee file:   /home/sammela/public_html/wp-includes/template-loader.php</p>
<p style="margin-top: 0px; margin-bottom: 0px;">Callee line: 37</p>
<p style="margin-top: 0px; margin-bottom: 0px;">Callee function: require_once</p>
<p style="margin-top: 0px; margin-bottom: 0px;">&nbsp;</p>
<p style="margin-top: 0px;margin-bottom: 0px;font-weight: bold;color: #FF0000;">&nbsp;</p>
<p style="margin-top: 0px;margin-bottom: 0px;font-weight: bold;color: #FF0000;">Caller file:   /home/sammela/public_html/wp-includes/template-loader.php</p>
<p style="margin-top: 0px;margin-bottom: 0px;font-weight: bold;color: #FF0000;">Caller line: 37</p>
<p style="margin-top: 0px;margin-bottom: 0px;font-weight: bold;color: #FF0000;">Callee file:   /home/sammela/public_html/wp-content/themes/Sam-Cutline-1-1.4-2ColumnRight/sandbox.php</p>
<p style="margin-top: 0px;margin-bottom: 0px;font-weight: bold;color: #FF0000;">Callee line: 23</p>
<p style="margin-top: 0px;margin-bottom: 0px;font-weight: bold;color: #FF0000;">Callee function: include</p>
<p style="margin-top: 0px;margin-bottom: 0px;font-weight: bold;color: #FF0000;">&nbsp;</p>
<p style="margin-top: 0px; margin-bottom: 0px;">&nbsp;</p>
<p style="margin-top: 0px; margin-bottom: 0px;">Caller file:   /home/sammela/public_html/wp-content/themes/Sam-Cutline-1-1.4-2ColumnRight/sandbox.php</p>
<p style="margin-top: 0px; margin-bottom: 0px;">Caller line: 23</p>
<p style="margin-top: 0px; margin-bottom: 0px;">Callee file: </p>
<p style="margin-top: 0px; margin-bottom: 0px;">Callee line: </p>
<p style="margin-top: 0px; margin-bottom: 0px;">Callee function: ssm_show_trace</p>
<p style="margin-top: 0px; margin-bottom: 0px;">&nbsp;</p>
<p style="margin-top: 0px; margin-bottom: 0px;  font-family:Courier, monospace;">|||||||||||||||||||||||||||</p>
<p style="margin-top: 0px; margin-bottom: 0px;  font-family:Courier, monospace;">+++++++++++++++++++++++++++</p>
</div>
</ol>
<h3>Download WiPeD with BackTrace</h3>
<p>Download a copy of WiPeD with BackTrace <a class="wpGallery" title="WiPeD Download" href="http://www.sammela.com/downloads/wiped.zip">here</a>.  </p>
<p>As stated previously, the original author of this excellent plugin is Sterling Camden.  His company is <a href="http://camdensoftware.com/" target="_blank">Camden Software Consulting</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sammela.com/2009/10/07/add-backtrace-to-the-wiped-wordpress-debugger/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WiPeD: A Useful WordPress Debugger Plugin</title>
		<link>http://sammela.com/2009/10/06/wiped-a-useful-wordpress-debugger-plugin/</link>
		<comments>http://sammela.com/2009/10/06/wiped-a-useful-wordpress-debugger-plugin/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 22:37:50 +0000</pubDate>
		<dc:creator>Sam Mela</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[article]]></category>

		<guid isPermaLink="false">http://sammela.com/?p=243</guid>
		<description><![CDATA[I like the WiPeD (WordPress Printf Debugging) Plugin for four reasons:

It does what I want
It is easy to install
It is easy to use
It is easy to customize

As a bonus, I should say, I talked to the author (Sterling &#8220;Chip&#8221; Camden)  on the phone today, and he&#8217;s very helpful.
Problems with echo
PHP programmers typically use the echo keyword [...]]]></description>
			<content:encoded><![CDATA[<p>I like the WiPeD (WordPress Printf Debugging) Plugin for four reasons:</p>
<ol>
<li>It does what I want</li>
<li>It is easy to install</li>
<li>It is easy to use</li>
<li>It is easy to customize</li>
</ol>
<p>As a bonus, I should say, I talked to the author (Sterling &#8220;Chip&#8221; Camden)  on the phone today, and he&#8217;s very helpful.</p>
<h3>Problems with echo</h3>
<p>PHP programmers typically use the <strong>echo</strong> keyword to output debugging information.</p>
<p>But there are some annoyances  with this approach.</p>
<ol>
<li>Echo output that precedes headers can cause PHP errors.</li>
<li>Echo statements are difficult to turn on and off.</li>
<li>It can be difficult to locate diagnostic echo statements when they are sprinkled throughout code.</li>
</ol>
<h3>WiPeD to the Rescue</h3>
<p>WiPeD solves the problems listed above by queing diagnostic outputs.  The diagnostic data is then dumped all at one, at a location chosen by the programmer.</p>
<p>Once the plugin is installed, it is a simple matter to write debug information to the queue.  Here&#8217;s an example:</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:75px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">// Queue a message<br />
WPD_print(&quot;This is a test of the WiPeD WPD_print function&quot;);</div></td></tr></tbody></table></div>
<h3>Output</h3>
<p>Typically you don&#8217;t have to worry about output.  In the default install configuration, WiPeD outputs the queued diagnostic data on the <strong>get_footer </strong>and <strong>admin_footer</strong> actions, which means it winds up at the bottom of your page.  Note, however, you can set it to display on any actions you want (see &#8220;Options&#8221; below).</p>
<h3>Options</h3>
<p>When WiPeD is installed, it adds a &#8220;WiPeD&#8221; options menu item to the bottom of the Admin &#8220;Settings&#8221; menu.  In the otpions menu you can set the following:</p>
<ul>
<li>User capability level required to record debug info</li>
<li>User capability level required to display debug info</li>
<li>Actions that trigger display of debug info</li>
<li>Clear debug log when displayed (check yes/no)</li>
<li>Clear debug log now (check yes/no)</li>
</ul>
<h3>Summary</h3>
<p>WiPeD is a handy expanable debug support Plugin that does just what it should. </p>
<p>Want it?  Visit the WiPeD links below:</p>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" style="padding-right:15px">&nbsp;</td>
<td align="left" valign="top" style="padding-right:15px">Author:</td>
<td align="left" valign="top"> <a href="http://chipsquips.com" title="Visit author homepage" target="_blank"  >Sterling &#8220;Chip&#8221; Camden</a></td>
</tr>
<tr>
<td align="left" valign="top"  style="padding-right:15px">&nbsp;</td>
<td align="left" valign="top" style="padding-right:15px">Visit:</td>
<td align="left" valign="top"><a href="http://chipstips.com/?tag=phpwpd" title="Visit plugin site" target="_blank"  >plugin site</a> </td>
</tr>
</table>
<p>&nbsp;</p>
<h3>Related Article</h3>
<p><a href="2009/10/07/add-backtrace-to-the-wiped-wordpress-debugger/" target="_blank">Add backtrace to the WiPeD Debugger.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sammela.com/2009/10/06/wiped-a-useful-wordpress-debugger-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make a WordPress Template Sandbox</title>
		<link>http://sammela.com/2009/09/30/make-a-wordpress-template-sandbox/</link>
		<comments>http://sammela.com/2009/09/30/make-a-wordpress-template-sandbox/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 04:31:52 +0000</pubDate>
		<dc:creator>Sam Mela</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[article]]></category>

		<guid isPermaLink="false">http://sammela.com/?p=222</guid>
		<description><![CDATA[Are you learning how do make code modifications in WordPress?
Sometimes you just want to experiment. 
But it is messy and risky to make changes in the standard template pages such as index.php, page.php, archive.php, etc. So the best thing to do is make yourself a code sandbox.
A sandbox template should pull in all the infrastructure [...]]]></description>
			<content:encoded><![CDATA[<p>Are you learning how do make code modifications in WordPress?</p>
<p>Sometimes you just want to experiment. </p>
<p>But it is messy and risky to make changes in the standard template pages such as index.php, page.php, archive.php, etc. So the best thing to do is make yourself a code sandbox.</p>
<p>A sandbox template should pull in all the infrastructure you need but allow you to write custom code and try things out. In WordPress, a custom template fulfills these requirements.  This article tells you how to build one.</p>
<p>First, if you are not familiar with the directory structure of themes in WordPress, read my article titled <a href="2009/09/29/the-wordpress-theme-directory-structure/">The Theme Directory Structure</a>.</p>
<h3>Build Your Sandbox</h3>
<p>Armed with knowledge from my Theme directory structure article, go to the directory of your favorite  theme and copy the <strong>index.php</strong> file to a file called <strong>sandbox.php</strong>.</p>
<p>Add the following line to the top of the <strong>sandbox.php</strong> file.</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #666666; font-style: italic;">/*<br />
Template Name: SandBox<br />
*/</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<p>That&#8217;s it.  You have created the basic sandbox.</p>
<p>If you are working locally on a PC or MAC, upload <strong>sandbox.php</strong> to your site.</p>
<h3>Using Your Sandbox Template</h3>
<p>To use your sandbox template, you can either create a new WordPress page or modify and old one.  I suggest creating a new one for starters. Let&#8217;s make a page called &#8220;sb&#8221;.</p>
<p>Now, if you want to view the results of your experimental changes to <strong>sandbox.php</strong>, you can just view your new page.</p>
<p>Now you can start making changes in your <strong>sandbox.php</strong> page.  </p>
<p>At the bottom of my <strong>sandbox.php</strong> page is the code that displays the sidebar, shown below:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span> get_sidebar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<p>What happens if you add a put some html code just above the get_sidebar function?</p>
<p>Now our code looks like the following?</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;table border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;<br />
&nbsp; &lt;tr&gt;<br />
&nbsp; &nbsp; &lt;td&gt;This is a table&lt;/td&gt;<br />
&nbsp; &nbsp; &lt;td&gt;above the right sidebar&lt;/td&gt;<br />
&nbsp; &lt;/tr&gt;<br />
&nbsp; &lt;tr&gt;<br />
&nbsp; &nbsp; &lt;td&gt;This is row 2&lt;/td&gt;<br />
&nbsp; &nbsp; &lt;td&gt;of the table&lt;/td&gt;<br />
&nbsp; &lt;/tr&gt;<br />
&lt;/table&gt;<br />
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_sidebar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<p>When you view the &#8220;sb&#8221; page, you should see a little table up above the sidebar.  Basically, you can try out any idea you want on the sandbox page and it won&#8217;t affect your main blog pages.</p>
<table>
<tr>
<td align="left" valign="top" style="padding-right:10px"><strong>TIP: </strong></td>
<td align="left" valign="top"><em>When you create a test page based on the sandbox template, make it &#8220;private&#8221;, so visitors to your blog won&#8217;t see it in the menu.</em>
<td>
</tr>
</table>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://sammela.com/2009/09/30/make-a-wordpress-template-sandbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Wordpress Theme Directory Structure</title>
		<link>http://sammela.com/2009/09/29/the-wordpress-theme-directory-structure/</link>
		<comments>http://sammela.com/2009/09/29/the-wordpress-theme-directory-structure/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 22:25:09 +0000</pubDate>
		<dc:creator>Sam Mela</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[article]]></category>

		<guid isPermaLink="false">http://sammela.com/?p=200</guid>
		<description><![CDATA[Wordpress uses a standard directory structure for storing themes.
Starting from your wordpress installation home directtor, all themes are stored in /wp-content/themes.
Each theme is stored in it&#8217;s own directory. The two themes that come with a standard WordPress installation are &#8220;WordPress Classic&#8221; and &#8220;WordPress Default&#8221;.  Their folders are located relative to the WordPress home directory as [...]]]></description>
			<content:encoded><![CDATA[<p>Wordpress uses a standard directory structure for storing themes.</p>
<p>Starting from your wordpress installation home directtor, all themes are stored in <strong>/wp-content/themes</strong>.</p>
<p>Each theme is stored in it&#8217;s own directory. The two themes that come with a standard WordPress installation are &#8220;WordPress Classic&#8221; and &#8220;WordPress Default&#8221;.  Their folders are located relative to the WordPress home directory as follows:</p>
<table border="0" cellspacing="0" cellpadding="2" style=" border: solid 1px #333333">
<tbody>
<tr style="border-bottom: solid 1px #333333">
<td style="padding-right:20x;border-bottom: solid 1px #333333;"><strong> Theme</strong></td>
<td style="border-bottom: solid 1px #333333;"><strong>Location</strong></td>
</tr>
<tr>
<td style="padding-right:20px;    ">WordPress Default</td>
<td>wp-content/themes/default</td>
</tr>
<tr>
<td style="padding-right:20x;">WordPress Classic</td>
<td>wp-content/themes/classic</td>
</tr>
</tbody>
</table>
<h3>Contents of the Theme Directory</h3>
<p>Within the Theme directory, minimally there will be the following files:</p>
<ul>
<li>index.php</li>
<li>header.php</li>
<li>sidebar.php</li>
<li>footer.php</li>
<li>functions.php</li>
<li>style.css</li>
</ul>
<p> Typically, there will be more.    Often there is an <strong>images</strong> sub-directory.</p>
<h3>How to Find Your Theme Directory</h3>
<ol>
<li>In the Site Admin Console, click on &#8220;Appearance&#8221; then &#8220;Themes&#8221;.</li>
<li>The &#8220;Current Theme&#8221; will be shown in the top right hand side of the screen.</li>
<li>The relative directory address will be listed below the Theme name.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://sammela.com/2009/09/29/the-wordpress-theme-directory-structure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keep Your Meta Tags Portable</title>
		<link>http://sammela.com/2009/09/28/keep-your-meta-tags-portable/</link>
		<comments>http://sammela.com/2009/09/28/keep-your-meta-tags-portable/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 05:22:45 +0000</pubDate>
		<dc:creator>Sam Mela</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[article]]></category>

		<guid isPermaLink="false">http://sammela.com/?p=145</guid>
		<description><![CDATA[It was difficult to think of an interesting title for this article. Maybe I should have called it &#8220;Save Time and Money &#8212; Keep Your Meta Tags Portable&#8221;, because eventually, if your Meta Tags are not portable, you&#8217;re going to invest time/money moving them.
Problem
The latest WordPress documentation says:
To add meta tags to your site, simply [...]]]></description>
			<content:encoded><![CDATA[<p>It was difficult to think of an interesting title for this article. Maybe I should have called it &#8220;Save Time and Money &#8212; Keep Your Meta Tags Portable&#8221;, because eventually, if your Meta Tags are not portable, you&#8217;re going to invest time/money moving them.</p>
<h3>Problem</h3>
<p>The latest WordPress documentation says:</p>
<blockquote><p>To add meta tags to your site, simply add them to the header.php template file in your WordPress Theme, specifically in the head section near the link for the style sheet.</p></blockquote>
<p>That works fine until you switch themes. The meta tags don&#8217;t follow you to the next theme. This may not be obvious at first. Your search engine rankings may go down if the Google, Yahoo, or Bing search engines cannot verify your site &#8212; an activity they do from time to time. But it could take a long time to trace this back to the missing meta tags, and meanwhile your site is losing <span style="color: #008000;"><strong>$</strong></span>traffic. </p>
<p>Not good.</p>
<h3>Solution</h3>
<p>Use a Wordpress Meta Tag Plugin.</p>
<p>I&#8217;m agnostic about which Meta Tag Plugin to use, but I will tell you that I am using Meta Tag Manager Wordpress Plugin from <a href="http://netweblogic.com/" target="_blank&quot;">netweblogic</a>.  Just download it, install it, and activate it according to the instructions.  It shows up as a menu item under &#8220;Settings&#8221; in your Admin Dashboard.  Click on it and you should see something like the screen below.  Just add new tags and save the changes.</p>
<div class="wp-caption alignnone" style="width: 510px"><a href="http://netweblogic.com/wordpress/plugins/meta-tag-manager/"><img title="Meta Tag Manager" src="http://sammela.com/articles/images/meta-tag-manager.gif" alt="Meta Tag Manager"/></a><p class="wp-caption-text">Meta Tag Manager</p></div>
<p>You&#8217;re done.</p>
<h3>Double Check Your Work</h3>
<p>Finally, make sure your tags are really showing up.  Navigate to your blog use your browser &#8220;view page source&#8221; capability to view the source of the page.  Make sure your meta tags are included.</p>
]]></content:encoded>
			<wfw:commentRss>http://sammela.com/2009/09/28/keep-your-meta-tags-portable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sitemaps and Google Webmaster &#8212; Like Milk and Cookies</title>
		<link>http://sammela.com/2009/09/27/sitemaps-and-google-webmaster-like-milk-and-cookies/</link>
		<comments>http://sammela.com/2009/09/27/sitemaps-and-google-webmaster-like-milk-and-cookies/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 18:54:46 +0000</pubDate>
		<dc:creator>Sam Mela</dc:creator>
				<category><![CDATA[article]]></category>

		<guid isPermaLink="false">http://sammela.com/?p=97</guid>
		<description><![CDATA[This is an article about Sitemaps and Google Webmaster Tools.
This article won&#8217;t tell you how to make a Sitemap or how to use Google Webmaster Tools.   There are plenty of good articles that explain the mechanics of Sitemaps and Webmaster Tools (see Add a Sitemap to Your Wordpress Site).  But sometimes it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://sammela.com/articles/images/milk-and-cookies.png" alt="Milk and cookies" style="border-width:0px;" align="right"/>This is an article about Sitemaps and Google Webmaster Tools.</p>
<p>This article won&#8217;t tell you how to make a Sitemap or how to use Google Webmaster Tools.   There are plenty of good articles that explain the mechanics of Sitemaps and Webmaster Tools (see <a href="http://sammela.com/2009/09/26/add-a-sitemap-to-your-wordpress-site/">Add a Sitemap to Your Wordpress Site</a>).  But sometimes it&#8217;s good to get up above the trees and see the big picture.</p>
<h2>In a Nutshell</h2>
<p>When people search the web using Google, you want them to find your Site.</p>
<p>But if Google doesn&#8217;t have the right information, it won&#8217;t return links to your Site.</p>
<p>Yes, Google needs information about your Site.  Why is this?</p>
<p>Well, let&#8217;s look at an example.</p>
<p><img src="http://sammela.com/articles/images/oscar.jpg" alt="Milk and cookies" style="border:1px solid  #cccccc; margin-left:5px;" align="right"/>Suppose someone is a dog lover.  This person wants Google to find links to pages with dogs.  More specifically, suppose this person types &#8220;Boston Terrier&#8221; into the Google search box, and hits return.</p>
<p>So now the Google search engine has two problems to solve.  First, it wants to find site with the &#8220;Boston Terrier&#8221; content.  Second, it doesn&#8217;t want to return unpopular sites.  It wants to return a site people are interested in, otherwise people will stop using Google and start using another search engine.</p>
<p>So the Google search engine really as two problems to solve &#8212; <strong>content </strong>and <strong>popularity</strong>.</p>
<h2>How Google Keeps Track of Content</h2>
<p>We&#8217;ll discuss popularity (called &#8220;ranking&#8221;) later in this article, but for now the topic is content.</p>
<p>How does the Google search engine  keep track of everything on the Web?</p>
<p>Well, the truth is, the Google search engine doesn&#8217;t keep track of EVERYTHING on the Web; but it <em>tries </em>to.</p>
<p>Someplace (probably more than one place) Google corporation has an enormous number of big Server machines with lots of hard drives and backup media, just for keeping lists of what is on the World Wide Web.</p>
<p>But the problem (actually opportunity) for Google is that web content keeps changing.  Each day trillions pieces of new information are added to the Web.</p>
<p>So the Google search engine is constantly combing through the web in a process called &#8220;crawling&#8221;.</p>
<p>Here is the definition of &#8220;crawling&#8221;, according to <a href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&#038;answer=70897#1" target="_blank">a Google Webmaster help page</a>,:</p>
<blockquote><p>&#8220;Crawling is the process by which Googlebot discovers new and updated pages to be added to the Google index.&#8221;</p></blockquote>
<p>Google goes on to say the following:</p>
<blockquote><p>We use a huge set of computers to fetch (or &#8220;crawl&#8221;) billions of pages on the web. The program that does the fetching is called Googlebot (also known as a robot, bot, or spider). Googlebot uses an algorithmic process: computer programs determine which sites to crawl, how often, and how many pages to fetch from each site.</p></blockquote>
<h2>Another Way Google Tracks Content</h2>
<p>As described in the previous section, the Google search engine is constantly looking at sites on the Web to build indices of Web content.  But there is still a lot of content that the Google search engine cannot process.</p>
<p>For instance, if you submit a video to YouTube, the Google search engine can&#8217;t (yet!) watch the video and create index data based on the content of the Video.</p>
<p>Also, more sophisticated Web sites build their pages dynamically, meaning that pages and content of pages change, depending upon user input.  It is difficult or impossible for the search engine to build an index of such a site.</p>
<p>So there is some content that the Google search engine cannot find or index by crawling. Still, the authors of such sites want people to be able to find their content and the operators of the search engines want to be able to find the content.  Therefore, Sitemaps were invented.</p>
<p>A Sitemap is a protocol webmasters use to tell search engines about Web pages that are available for crawling.  Below is a very simple example of a Sitemap.  Again, we leave it to other documents and articles to give detailed technical descriptions.  Suffice it to say, the information in the Sitemap helps the Google search engine to find pages on your site.  <a href="http://www.sitemaps.org" target="_blank">http://www.sitemaps.org</a> has official specifications and other useful information.</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;urlset</span><span style="color: #ff0000;">&quot;&gt;</span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;loc<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://ssmela.googlepages.com/<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/loc<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;loc<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://ssmela.googlepages.com/AnonymousClassesinJava.pdf<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/loc<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;loc<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://ssmela.googlepages.com/NetbeansMacrodef.pdf<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/loc<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/urlset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></td></tr></tbody></table></div>
<h2 style="margin-top:20px">Submitting the Sitemap</h2>
<p>At the beginning of this article, I implied that Sitemaps and Google Webmaster Tools go together like milk and cookies.  Here&#8217;s why &#8212; once your Sitemap is ready, you register your Site with Google Webmaster Tools and then submit your Sitemap.</p>
<p>You join Google Webmaster Tools pretty much the same way you join any other Google Application Service.  Just go to the <a href="https://www.google.com/webmasters/tools" target="_blank">Google Webmaster Tools Site</a> and sign in with an existing Google Account Name/Password or create a new one.  Then follow the instructions for registering your Site and submitting your Sitemap.</p>
<p>If you have followed reasonable rules of SEO (Search Engine Optimization) in creating your site and your site has good quality content then you are off and running.  Of course, Google makes different types of reports available.  <a href="http://www.clickz.com/3634476" target="_blank">Demystifying Google Webmaster Tools Reports</a> is a nice place to start reading about them.</p>
<h2>Other Search Engines</h2>
<p>As you know, Google isn&#8217;t the only search engine.  Both <a href="http://www.bing.com/webmaster">Microsoft Bing</a> and <a href="https://siteexplorer.search.yahoo.com/">Yahoo Search</a> have tools for registering your Site and submitting Sitemaps.  Check them out too.</p>
<h2>Ranking (popularity)</h2>
<p>As promised earlier, we include here a brief section on the topic of ranking.  It&#8217;s just the way it sounds.  The Google search engine ranks pages.  Google&#8217;s method is not disclosed but it is generally understood to be based on popularity.  This includes factors like how many times people search for your site, how many other sites link to your site, and the ranking of the sites that have links to your site, and possibly how long your site has been around.</p>
<p>There is a marketing specialty called Search Engine Optimization (SEO) that deals with optimizing your site to improve its search engine rankings.  See the <a href="http://en.wikipedia.org/wiki/Search_engine_optimization" target="_blank">Wikipedia Article on Search Engine Optimization</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sammela.com/2009/09/27/sitemaps-and-google-webmaster-like-milk-and-cookies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add a Sitemap to Your WordPress Site</title>
		<link>http://sammela.com/2009/09/26/add-a-sitemap-to-your-wordpress-site/</link>
		<comments>http://sammela.com/2009/09/26/add-a-sitemap-to-your-wordpress-site/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 02:04:07 +0000</pubDate>
		<dc:creator>Sam Mela</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[article]]></category>

		<guid isPermaLink="false">http://sammela.com/?p=54</guid>
		<description><![CDATA[
In a previous article (Sitemaps and Google Webmaster — Like Milk and Cookies) I explained why it is important to register your Sitemap with Google.  This article tells you how to create a Sitemap for your Wordpress site and register it with Google.
Sitemap Plugin Eases the Job
Google accepts Sitemaps in several formats, but it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://sammela.com/articles/images/skewed-text1.png" alt="Sitmap Text" style="border-width:0px;"/></p>
<p>In a previous article (<a href="http://sammela.com/2009/09/27/sitemaps-and-google-webmaster-like-milk-and-cookies/">Sitemaps and Google Webmaster — Like Milk and Cookies</a>) I explained why it is important to register your Sitemap with Google.  This article tells you how to create a Sitemap for your Wordpress site and register it with Google.</p>
<h3>Sitemap Plugin Eases the Job</h3>
<p>Google accepts Sitemaps in several formats, but it&#8217;s time consuming to create WordPress site by hand.  Furthermore, you will neeed to update the map every time you add or delete an article.   Here&#8217;s the good news &#8212; there are a number of excellent WordPress Plugins that do the job of creating Sitemaps for you.</p>
<p>I use a Plugin called &#8220;Sitemap Index&#8221; Version 1.2.2, by Twardes (<a href="http://torrentlist.pl/sitemap-index-plugin">http://torrentlist.pl/sitemap-index-plugin</a>).  This Plugin generates sitemaps dynamically, meaning that the sitemap is regenerated every time the Sitemap file is accessed.</p>
<p>It couldn&#8217;t be easier to install and use.  In the Plugins section of the WordPress Admin console, click on &#8220;Add New&#8221;.  Search on &#8220;sitemap index&#8221; (quotes included), and the &#8220;Sitemap Index&#8221; should be included in the result list.</p>
<p>Under &#8220;actions&#8221; on the right side of the screen, click &#8220;install&#8221;. It&#8217;s that easy.</p>
<h3>Get the URL of the Sitemap</h3>
<p>Click on Plugins on the left side of the WordPress Admin screen, then click on Sitemap Index &#8220;settings&#8221; on the right side of the screen.</p>
<p>You should see something like the following screen shot. Copy the Sitemap address so you can paste it into Google Webmaster Tools.</p>
<p><img src="http://sammela.com/articles/images/sitemap_index_settings.png" alt="Sitemap Index Settings Screen" /></p>
<h3>Add the Site and Sitemap to Google Webmaster Tools</h3>
<p> If you don&#8217;t already have a Google Webmaster Account, go to <a href="http://www.google.com/webmasters" target="_blank">http://www.google.com/webmasters</a> and create one.</p>
<p>It is very important to register your site with Google, because Google is the most popular search engine.</p>
<ol>
<li>Log into Webmaster Tools, and on the right-hand side of the screen click the &#8220;Add a Site&#8221; button.</li>
<li>Enter the name of your site and hit &#8220;enter&#8221;.</li>
<li>Now you should be in the Verification screen, which looks like the screenshot below.  You&#8217;ll need to copy the verification &#8220;meta&#8221; tag from the Webmaster tool back to the header.php file on your site.  </li>
</ol>
<p><img src="http://sammela.com/articles/images/webmaster_site_verification.png" alt="Sitemap Index Settings Screen" /></p>
<ol CONTINUE>
<li value="4">The header.php file is located in the same folder as your theme.</li>
<li>Using your favorite code editor, open header.php and look for a reasonable place to put the meta tag.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://sammela.com/2009/09/26/add-a-sitemap-to-your-wordpress-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
