<?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>web2.0goodies.com &#187; php5</title>
	<atom:link href="http://web2.0goodies.com/blog/category/php5/feed/" rel="self" type="application/rss+xml" />
	<link>http://web2.0goodies.com/blog</link>
	<description>Tips, Tricks, and How To's for Web 2.0</description>
	<lastBuildDate>Tue, 03 Jan 2012 05:34:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Quickly turn on error reporting to see errors.</title>
		<link>http://web2.0goodies.com/blog/php5/quickly-turn-on-error-reporting-to-see-errors/</link>
		<comments>http://web2.0goodies.com/blog/php5/quickly-turn-on-error-reporting-to-see-errors/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 19:45:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php5]]></category>

		<guid isPermaLink="false">http://web2.0goodies.com/blog/?p=208</guid>
		<description><![CDATA[I frequently run into a page where php isn&#8217;t displaying errors&#8230; A quick way to turn them on without changing the php.ini file is: error_reporting(E_ALL &#038; ~E_DEPRECATED); ini_set('display_errors', 'on'); Note: This will not show compile / fatal errors, as the page won&#8217;t even run, but if it&#8217;s just a regular non syntax related error, it [...]]]></description>
			<content:encoded><![CDATA[<p>I frequently run into a page where php isn&#8217;t displaying errors&#8230;  A quick way to turn them on without changing the php.ini file is:</p>
<pre class="code">
error_reporting(E_ALL &#038; ~E_DEPRECATED);

ini_set('display_errors', 'on');
</pre>
<p><strong>Note:</strong> This will not show compile / fatal errors, as the page won&#8217;t even run, but if it&#8217;s just a regular non syntax related error, it will not be displayed.</p>
<p><strong>Update</strong> Thanks for the way to remove deprecated warnings Jacob. </p>
]]></content:encoded>
			<wfw:commentRss>http://web2.0goodies.com/blog/php5/quickly-turn-on-error-reporting-to-see-errors/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Generating Documentation from XML using xslt</title>
		<link>http://web2.0goodies.com/blog/php5/generating-documentation-from-xml-using-xslt/</link>
		<comments>http://web2.0goodies.com/blog/php5/generating-documentation-from-xml-using-xslt/#comments</comments>
		<pubDate>Sun, 10 Jul 2011 18:15:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php5]]></category>

		<guid isPermaLink="false">http://web2.0goodies.com/blog/?p=202</guid>
		<description><![CDATA[When I worked at Infusionsoft I re-cycled some code I used to generate a php sdk into code that would generate documentation for the API, it wasn&#8217;t pretty but since I didn&#8217;t get official time to do it that&#8217;s what happens. I left the company, but fortunately Vivin Paliath is actively maintaining the auto-generation of [...]]]></description>
			<content:encoded><![CDATA[<p>When I worked at Infusionsoft I re-cycled some code I used to generate a php sdk into code that would generate documentation for the API, it wasn&#8217;t pretty but since I didn&#8217;t get official time to do it that&#8217;s what happens.  I left the company, but fortunately Vivin Paliath is actively maintaining the auto-generation of the documentation using xslt, see: <a href="http://networkedblogs.com/kco7J">http://networkedblogs.com/kco7J</a>  Now, if he gets it Mavenized, and part of the formal build process than it will be the icing on the cake for all of us Infusionsoft API developers.</p>
]]></content:encoded>
			<wfw:commentRss>http://web2.0goodies.com/blog/php5/generating-documentation-from-xml-using-xslt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Baking Cake Controllers and Views</title>
		<link>http://web2.0goodies.com/blog/php5/baking-cake-controllers-and-views/</link>
		<comments>http://web2.0goodies.com/blog/php5/baking-cake-controllers-and-views/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 23:42:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php5]]></category>

		<guid isPermaLink="false">http://web2.0goodies.com/blog/php5/baking-cake-controllers-and-views/</guid>
		<description><![CDATA[Scaffold is awesome!&#160; It genereates everything you need for CRUD, and is fully customizeable&#8230; To use it do&#8230; cake bake controller {controllername} scaffold&#160;&#160; (NOT scaffolding) To make the views cake bake view {controllername} Viola!&#160; Instant coolness.]]></description>
			<content:encoded><![CDATA[<p>Scaffold is awesome!&nbsp; It genereates everything you need for CRUD, and is fully customizeable&#8230;</p>
<p>To use it do&#8230;</p>
<p>cake bake controller {controllername} scaffold&nbsp;&nbsp; <b>(NOT scaffolding)</b></p>
<p>To make the views</p>
<p>cake bake view {controllername}</p>
<p>Viola!&nbsp; Instant coolness.</p>
]]></content:encoded>
			<wfw:commentRss>http://web2.0goodies.com/blog/php5/baking-cake-controllers-and-views/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Never ever ever make a php config file not a php file&#8230;</title>
		<link>http://web2.0goodies.com/blog/php5/never-ever-ever-make-a-php-config-file-not-a-php-file/</link>
		<comments>http://web2.0goodies.com/blog/php5/never-ever-ever-make-a-php-config-file-not-a-php-file/#comments</comments>
		<pubDate>Mon, 08 Nov 2010 21:55:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[http]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://web2.0goodies.com/blog/php5/never-ever-ever-make-a-php-config-file-not-a-php-file/</guid>
		<description><![CDATA[I was using a php sdk today where the config file is NOT a php file, but rather a file named .cfg&#8230; The problem?&#160; You have to restrict access to this file with a .htaccess file to prevent someone from reading it.&#160; Whereas, if it were a php file, not only would you not have [...]]]></description>
			<content:encoded><![CDATA[<p>I was using a php sdk today where the config file is NOT a php file, but rather a file named .cfg&#8230; </p>
<p>The problem?&nbsp; You have to restrict access to this file with a .htaccess file to prevent someone from reading it.&nbsp; Whereas, if it were a php file, not only would you not have to prevent access to it, you also don&#8217;t have to write your own parser.</p>
<p>Lesson&#8230;&nbsp; Don&#8217;t use a cfg file, where a php config file will do.</p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=2f61917a-08ac-8f23-80ac-5d4252cc2ef7" /></div>
]]></content:encoded>
			<wfw:commentRss>http://web2.0goodies.com/blog/php5/never-ever-ever-make-a-php-config-file-not-a-php-file/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Uniserver &#8211; Things I Learned Today</title>
		<link>http://web2.0goodies.com/blog/php5/uniserver-things-i-learned-today/</link>
		<comments>http://web2.0goodies.com/blog/php5/uniserver-things-i-learned-today/#comments</comments>
		<pubDate>Tue, 26 Oct 2010 06:49:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://web2.0goodies.com/blog/php5/uniserver-things-i-learned-today/</guid>
		<description><![CDATA[Uniserver on Windows REQUIRES the .htaccess file to have the &#8220;Options +ExecCGI +FollowSymLinks&#8221; line in it&#8230; Or else you get a 403 forbidden on every page you try to access.]]></description>
			<content:encoded><![CDATA[<p>Uniserver on Windows REQUIRES the .htaccess file to have the &#8220;Options +ExecCGI +FollowSymLinks&#8221; line in it&#8230; Or else you get a 403 forbidden on every page you try to access.</p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=34bda74f-2b19-8be6-b827-9b5d4a06a083" /></div>
]]></content:encoded>
			<wfw:commentRss>http://web2.0goodies.com/blog/php5/uniserver-things-i-learned-today/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Awesome Prototyping Tool!</title>
		<link>http://web2.0goodies.com/blog/php5/awesome-prototyping-tool/</link>
		<comments>http://web2.0goodies.com/blog/php5/awesome-prototyping-tool/#comments</comments>
		<pubDate>Mon, 25 Oct 2010 16:48:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[design]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[user interaction]]></category>
		<category><![CDATA[wysiwyg editors]]></category>

		<guid isPermaLink="false">http://web2.0goodies.com/blog/php5/awesome-prototyping-tool/</guid>
		<description><![CDATA[Check out this AWESOME free prototyping tool. Pencil Project.&#160; (It&#8217;s a Firefox Plugin / XUL Application) It let&#8217;s you mock up fully functional websites without writing any html code.&#160; Then, you can export it as html, and use it as a starting point for a better mockup.&#160; Or export all the pages to png&#8217;s in [...]]]></description>
			<content:encoded><![CDATA[<p>Check out this AWESOME free prototyping tool. Pencil Project.&nbsp; (It&#8217;s a Firefox Plugin / XUL Application)</p>
<p>It let&#8217;s you mock up fully functional websites without writing any html code.&nbsp; Then, you can export it as html, and use it as a starting point for a better mockup.&nbsp; Or export all the pages to png&#8217;s in one shot, and use those as a starting point in Adobe Illustrator, or your design tool of choice.</p>
<p>It&#8217;s great for useability testing.&nbsp; Mockup your ideas.&nbsp; Put them in front of customers / users, re-prototype, and continue until you get it as good as possible, and meeting your cash cow customers&#8217; needs.&nbsp; THEN make it look good.</p>
<p><a href="http://pencil.evolus.vn/en-US/Home.aspx">http://pencil.evolus.vn/en-US/Home.aspx</a></p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=011af74a-24e6-81ca-90a8-670e7ce9f445" /></div>
]]></content:encoded>
			<wfw:commentRss>http://web2.0goodies.com/blog/php5/awesome-prototyping-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Things I Learned Today</title>
		<link>http://web2.0goodies.com/blog/php5/things-i-learned-today/</link>
		<comments>http://web2.0goodies.com/blog/php5/things-i-learned-today/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 05:13:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php5]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://web2.0goodies.com/blog/php5/things-i-learned-today/</guid>
		<description><![CDATA[Uniserver on Windows REQUIRES the .htaccess file to have the &#8220;Options +ExecCGI +FollowSymLinks&#8221; line in it&#8230; Or else you get a 403 forbidden on every page you try to access.]]></description>
			<content:encoded><![CDATA[<p>Uniserver on Windows REQUIRES the .htaccess file to have the &#8220;Options +ExecCGI +FollowSymLinks&#8221; line in it&#8230; Or else you get a 403 forbidden on every page you try to access.</p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=ae4d07ac-462b-8b0b-9334-1f6df4e05f49" /></div>
]]></content:encoded>
			<wfw:commentRss>http://web2.0goodies.com/blog/php5/things-i-learned-today/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phpMiniAdmin</title>
		<link>http://web2.0goodies.com/blog/php5/phpminiadmin/</link>
		<comments>http://web2.0goodies.com/blog/php5/phpminiadmin/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 00:06:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://web2.0goodies.com/blog/?p=94</guid>
		<description><![CDATA[I&#8217;ve used phpMyAdmin for a while, but I find it to be a little heavyweight at times. Sometimes I just want to run a simple query. The MySQL client is obtuse to use sometimes. So I went on a search for alternatives. I now use phpMiniAdmin almost exclusively. It&#8217;s extremely light weight, fast and has [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve used phpMyAdmin for a while, but I find it to be a little heavyweight at times.  Sometimes I just want to run a simple query.  The MySQL client is obtuse to use sometimes.  So I went on a search for alternatives.</p>
<p>I now use <a href="http://phpminiadmin.sourceforge.net/">phpMiniAdmin</a> almost exclusively.  It&#8217;s extremely light weight, fast and has LOTS of neat features.  It provides everything I need 99.9% of the time. And it&#8217;s easier to configure then phpMyAdmin.</p>
]]></content:encoded>
			<wfw:commentRss>http://web2.0goodies.com/blog/php5/phpminiadmin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento &#8211; WOW!</title>
		<link>http://web2.0goodies.com/blog/php5/magento-wow/</link>
		<comments>http://web2.0goodies.com/blog/php5/magento-wow/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 05:55:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php5]]></category>

		<guid isPermaLink="false">http://web2.0goodies.com/blog/?p=86</guid>
		<description><![CDATA[Some say that Magento is horrible to work with. I say they are wrong. Magento is one of the most well designed pieces of software I&#8217;ve ever seen. Complete inversion of control. Awesome extendability. Sweet seperation of concerns. Proper use of classes, it&#8217;s all there. But&#8230; It&#8217;s under documented, and it has a few core [...]]]></description>
			<content:encoded><![CDATA[<p>Some say that Magento is horrible to work with.  I say they are wrong.  Magento is one of the most well designed pieces of software I&#8217;ve ever seen.  Complete inversion of control.  Awesome extendability.  Sweet seperation of concerns.  Proper use of classes, it&#8217;s all there.</p>
<p>But&#8230;  It&#8217;s under documented, and it has a few core concepts you have to understand before it makes sense.</p>
<p>Recently I need to make a new shipping method for myhomefurniturestore.com.  Fortunatly for me, <a href="http://blog.magentomagik.com/adding-new-shipping-module-in-magento/">magentomagick had a great article</a> that had instructions start to finish (except for two details that are mentioned in the comments) for just such a task.</p>
]]></content:encoded>
			<wfw:commentRss>http://web2.0goodies.com/blog/php5/magento-wow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>So you want PHP Templates, eh?</title>
		<link>http://web2.0goodies.com/blog/hacks/so-you-want-a-php-template-eh/</link>
		<comments>http://web2.0goodies.com/blog/hacks/so-you-want-a-php-template-eh/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 05:15:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[100 Weeks of PHP]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[php5]]></category>

		<guid isPermaLink="false">http://web2.0goodies.com/blog/?p=60</guid>
		<description><![CDATA[PHP Templates! Everyone wants them, some people try to provide them to others, but deep down inside, you all know smarty isn&#8217;t the way to go&#8230; Allow me to show you a better way. Just use PHP! Yes, that&#8217;s right! PHP is almost designed from the ground up natively support templates! Here&#8217;s the secret&#8230; When [...]]]></description>
			<content:encoded><![CDATA[<p>PHP Templates!  Everyone wants them, some people try to provide them to others, but deep down inside, you all know smarty isn&#8217;t the way to go&#8230;  Allow me to show you a better way.</p>
<p>Just use PHP!  Yes, that&#8217;s right!  PHP is almost designed from the ground up natively support templates!</p>
<p>Here&#8217;s the secret&#8230;  When you include a php file (using the include(&#8220;somefile.php&#8221;) method, the php code inside the included file has the same variable scope as the code block that included it&#8230;  So&#8230;  Take the following two files&#8230;.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">(index.php)
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
  go<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">function</span> go<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Hi There!&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'my_view.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">(my_view.php)
&lt;html&gt;
&lt;body&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$a</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>The output would be:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">Hi There<span style="color: #339933;">!</span></pre></div></div>

<p>If you&#8217;re a noob, another name for this (if you make extra effort to not put anything but loops, and echos in your template) is MVC (Model View Controller).  While it isn&#8217;t a complete implementation, it&#8217;s a really really good start and makes writing and maintaining a site WAY easier.  Cake PHP uses this approach for it&#8217;s views (aka templates) as well.  Java uses this, but instead of the &#8220;view&#8221; using the local variables where a page is displayed, the data you want the view (or jsp page in java) to have access to are put in the request object as an &#8220;attribute&#8221;.</p>
<p>I, personally, put the variables I want to use in a &#8220;template&#8221; (aka &#8220;view&#8221;) in a global array ($GLOBALS['params']['name'] = &#8220;bob&#8221;;)  It isn&#8217;t the best practice, because some part of your code far away could write to this and mess something up, but for simple sites, I find it quick and easy.  </p>
<p>Of course, if you REALLY want a templating system, you could use SMARTY.  (Blech!)  But, I really recommend you just get used the to the echo statements and use php to render templates.</p>
<p>So, some sample code from a site of mine is:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>BASE_FS_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/classes/BookService.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'Research'</span><span style="color: #339933;">:</span>
		<span style="color: #000088;">$book</span> <span style="color: #339933;">=</span> BookService<span style="color: #339933;">::</span><span style="color: #004000;">importBook</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ean'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$_GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'book'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$book</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span>BASE_FS_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/views/pages/research.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
		<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'mark_not_sellable'</span><span style="color: #339933;">:</span>
		<span style="color: #000088;">$book</span> <span style="color: #339933;">=</span> BookService<span style="color: #339933;">::</span><span style="color: #004000;">importBook</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ean'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$book</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sellable</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'no'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$book</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$_GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'msg'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Book Marked As Not Sellable.'</span><span style="color: #339933;">;</span>
		show_details<span style="color: #009900;">&#40;</span><span style="color: #000088;">$book</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'mark_not_available'</span><span style="color: #339933;">:</span>
		<span style="color: #000088;">$book</span> <span style="color: #339933;">=</span> BookService<span style="color: #339933;">::</span><span style="color: #004000;">importBook</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ean'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$book</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">available</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'no'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$book</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$_GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'msg'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Book Marked As Not Available.'</span><span style="color: #339933;">;</span>
		show_details<span style="color: #009900;">&#40;</span><span style="color: #000088;">$book</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'details'</span><span style="color: #339933;">:</span>
		<span style="color: #000088;">$book</span> <span style="color: #339933;">=</span> BookService<span style="color: #339933;">::</span><span style="color: #004000;">importBook</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ean'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		show_details<span style="color: #009900;">&#40;</span><span style="color: #000088;">$book</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">default</span><span style="color: #339933;">:</span>
		<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span>BASE_FS_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/views/pages/research.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> show_details<span style="color: #009900;">&#40;</span><span style="color: #000088;">$book</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$_GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'book'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$book</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span>BASE_FS_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/views/pages/details.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>And the &#8220;view&#8221; for this code (details.php) is:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;body style=&quot;width:950px; margin: 0 auto; text-align: left;&quot; class=&quot; yui-skin-sam&quot;&gt;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> 
			<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span>BASE_FS_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/views/pieces/menu_and_js.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
		&lt;div style=&quot;text-align: center;&quot;&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'msg'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
		&lt;/div&gt;
&nbsp;
		&lt;table&gt;
		 &lt;tr&gt;
		  &lt;td&gt;
			&lt;h1&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'book'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h2&gt;
			&lt;ul&gt;
			&lt;li&gt;Ean: <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'book'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ean</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/li&gt;
			&lt;li&gt;Available: <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'book'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">available</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/li&gt;
			&lt;li&gt;Imported: <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'book'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">import_date</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/li&gt;
			&lt;li&gt;Cost: <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'book'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cost</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/li&gt;
			&lt;li&gt;Change In Inventory: <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'book'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">change_in_inventory</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/li&gt;
			&lt;/ul&gt;
			&lt;h2&gt;Urls&lt;/h2&gt;
                         (More Code That's been removed for this example)</pre></div></div>

<p>Anyways, there are LOTs of templating engines out there you can use instead, but I would discourage it.  This is the fastest, simplest, most powerful way to do templates (IMO).</p>
]]></content:encoded>
			<wfw:commentRss>http://web2.0goodies.com/blog/hacks/so-you-want-a-php-template-eh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

