<?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>ReloadedPC Ashland, Ohio &#187; PHP</title>
	<atom:link href="http://www.reloadedpc.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.reloadedpc.com</link>
	<description>Small Business Website Development</description>
	<lastBuildDate>Wed, 01 Sep 2010 02:53:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>PetFinder API PHP Class Library</title>
		<link>http://www.reloadedpc.com/php/petfinder-api-php-class-library/</link>
		<comments>http://www.reloadedpc.com/php/petfinder-api-php-class-library/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 04:14:56 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[petfinder]]></category>
		<category><![CDATA[petfinder api]]></category>
		<category><![CDATA[php class]]></category>
		<category><![CDATA[php library]]></category>

		<guid isPermaLink="false">http://www.reloadedpc.com/?p=69</guid>
		<description><![CDATA[I was interested in a project for a website as to what data could be retrieved from PetFinder.com. To my surprise, on their website located in the footer is a link to their API documentation. In order to use their API, you must first fill out a developer request for a key &#38; password. I [...]]]></description>
			<content:encoded><![CDATA[<h3><span style="font-weight: normal; font-size: 13px;">I was interested in a project for a website as to what data could be retrieved from <a href="http://www.petfinder.com">PetFinder.com</a>. To my surprise, on their website located in the footer is a link to their <a href="http://www.petfinder.com/developers/api-docs#methods">API documentation</a>. In order to use their API, you must first fill out a developer request for a key &amp; password. I did a quick look to see if anyone had written a php class for accessing the api, but couldn&#8217;t find anything useful. I have created a php class that you can call the certain methods available to retrieve the records.</span></h3>
<h3>Update 6-30-2010:</h3>
<p>I recently updated the class to enable caching the xml response from the Petfinder server. This should provide a nice little speed boost even though it was already pretty fast <img src='http://www.reloadedpc.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' title="PetFinder API PHP Class Library" /> . Caching is enabled by default, and caches expires in 3 minutes. The folder &#8220;cache_files&#8221; in zip folder must have write permissions. As shown in the instructions, you can change the paths of cache files.</p>
<p><span id="more-69"></span>This class will parse the returned xml as a data array. This libary requires just 4 easy steps to get data:</p>
<ol>
<li>Add api-password to class</li>
<li>Add api-key to class</li>
<li>Pass configuration values as an array</li>
<li>Call the method in the class</li>
</ol>
<p>Here is an example of how to use the php class</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">include_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'class.petfinder.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//include class</span>
<span style="color: #000088;">$pet</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Petfinder<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//create Petfinder object</span>
<span style="color: #000088;">$pet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setKey</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'12345'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//your api-key</span>
<span style="color: #000088;">$pet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setPass</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'abcdef'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//your api-secret</span>
<span style="color: #000088;">$pet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cache_expire'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">360</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//(optional) Time in secs to expire  default shown</span>
<span style="color: #000088;">$pet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cache_path'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'full_path_to_cache_folder'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">//(optional) Set cache path </span>
<span style="color: #000088;">$pet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cache_enable'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//(optional) Disable cache feature </span>
&nbsp;
<span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'location '</span><span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'44805'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'animal'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'dog'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//associative array of values to pass to class. array keys must match arguments from API</span>
<span style="color: #000088;">$pet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">initialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">//pass values to the class</span>
<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$pet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">petFind</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//call API method which are accessed by camel casing them (pet.find=petFind)</span></pre></div></div>

<p>The xml data is returned as an associative array. The array has been mapped to the xml layout returned by PetFinder. Echo out the variable and you will see the returned status code, the array of returned values, and the xml response data from PetFinder.</p>
<p><a href="http://www.reloadedpc.com/petfinder/petfinder.php">Demo Output</a></p>
<p><a rel="attachment wp-att-72" href="http://www.reloadedpc.com/php/petfinder-api-php-class-library/attachment/class-petfinder/">Download Class File</a><br />
<a rel="attachment" href="http://www.reloadedpc.com/wp-content/uploads/2009/09/petfinder-v.9.zip">Download Demo + Class File</a></p>
<p>If you would like to donate, you may do so by using Paypal.</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="10530731" />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" type="image" />
<img src="https://www.paypal.com/en_US/i/scr/pixel.gif" border="0" alt="PetFinder API PHP Class Library pixel " width="1" height="1" title="PetFinder API PHP Class Library" /><br />
</form>
]]></content:encoded>
			<wfw:commentRss>http://www.reloadedpc.com/php/petfinder-api-php-class-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Codeigniter + Geshi</title>
		<link>http://www.reloadedpc.com/code-igniter/codeigniter-geshi/</link>
		<comments>http://www.reloadedpc.com/code-igniter/codeigniter-geshi/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 14:23:49 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Code Igniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[geshi]]></category>
		<category><![CDATA[php class]]></category>
		<category><![CDATA[php library]]></category>

		<guid isPermaLink="false">http://www.reloadedpc.com/?p=217</guid>
		<description><![CDATA[Geshi is a PHP class to do the heavy lifting for syntax highlighting output to your browswer. Geshi started originally to help users highlight code posted on bulletin board sites. I converted the standard Geshi class into a Codeigniter library. Just a simple as renaming the class and created a few methods to conform to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://qbnz.com/highlighter/">Geshi</a> is a PHP class to do the heavy lifting for syntax highlighting output to your browswer. <a href="http://www.reloadedpc.com/wp-content/uploads/2009/07/ci_logo_flame.jpg"><img class="alignright size-full wp-image-41" title="CodeIgniter Logo" src="http://www.reloadedpc.com/wp-content/uploads/2009/07/ci_logo_flame.jpg" alt="Codeigniter + Geshi ci logo flame " width="150" height="164" /></a>Geshi started originally to help users highlight code posted on bulletin board sites. I converted the standard Geshi class into a Codeigniter library. Just a simple as renaming the class and created a few methods to conform to some of the options you&#8217;ll find in codeigniter.<br />
<span id="more-217"></span><br />
Download <a href="http://www.reloadedpc.com/wp-content/uploads/2010/04/geshi-CI-library.zip">Codeigniter Geshi Library</a></p>
<p>Here&#8217;s how you will use this library in Codeigniter. First, extract the zip file and place the contents into your /application/libraries folder within your codeigniter folder structure.</p>
<p>Example code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">library</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'geshi'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//load geshi class</span>
&nbsp;
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'set_language'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'php'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//REQUIRED set language to parse</span>
<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'set_source'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'foreach($test as $item){ echo &quot;hello&quot;;}'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//REQUIRED set source code to parse</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">geshi</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">initialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">geshi</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">output</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//output from geshi alias of parse_code</span></pre></div></div>

<p>You can pass any geshi method or variable in the config array. Just name the key the same as the method or variable you are setting, and the value to what you would like to pass.</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="8DNGYPD3WRZCQ">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="Codeigniter + Geshi pixel " border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" title="Codeigniter + Geshi" /><br />
</form>
]]></content:encoded>
			<wfw:commentRss>http://www.reloadedpc.com/code-igniter/codeigniter-geshi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zencart Related Products</title>
		<link>http://www.reloadedpc.com/zen-cart/zencart-related-products/</link>
		<comments>http://www.reloadedpc.com/zen-cart/zencart-related-products/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 17:00:09 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zen-Cart]]></category>
		<category><![CDATA[related products]]></category>
		<category><![CDATA[zencart]]></category>

		<guid isPermaLink="false">http://www.reloadedpc.com/?p=155</guid>
		<description><![CDATA[Zen-cart is an excellent open source ecommerce shopping cart system. One of the features I like about Zen-cart is that once you understand the templating structure, writing plugins becomes pretty easy. One of the features I enjoyed using with osCommerce, was a plugin for creating a related products box below a displayed. The plugin was [...]]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_18" class="wp-caption alignright" style="width: 156px"><a href="http://www.zen-cart.com"><img class="size-full wp-image-18 " title="zen-cart-logo" src="http://www.reloadedpc.com/wp-content/uploads/2009/07/zen-cart-logo.png" alt="Zen-Cart" width="146" height="40" /></a><p class="wp-caption-text">Zen-Cart</p></div><a href="http://www.zen-cart.com">Zen-cart</a> is an excellent open source ecommerce shopping cart system. One of the features I like about Zen-cart is that once you understand the templating structure, writing plugins becomes pretty easy.</p>
<p>One of the features I enjoyed using with osCommerce, was a plugin for creating a related products box below a displayed. The plugin was easily implemented, and used an extra field add to the database. That was a great asset, that I felt missed using. Zen-cart offers something very similar in its port of XSell (Cross Sell). This feature would work fine if you are adding a few products at time, and do not have many related products. However, in my case, I have about 4,000 items in my catalog. The products are mostly lighting fixtures, which for must companies have coordinating fixtures for each room. This would be a bit cumbersome to create all of the related items. This is why I decided to write a quick plugin to get this simple functionality back.<span id="more-155"></span>The code works by simply selecting products that have the same products_family value from the products table. You will first need to add this field to your database.</p>
<p>The default products table is &#8220;zen_products&#8221;, and in your favorite MySQL editor add:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">ALTER TABLE zen_products ADD COLUMN products_family VARCHAR<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Next, you will need to add values to your new field family_products. The easiest to do this is to use custom fields in <a href="http://www.reloadedpc.com/zen-cart/zen-cart-easy-populate/">Easy Populate</a>. I added the code to Easy Poplulate for zen-cart to be able to add your own custom fields to the import/export file.</p>
<p>Now that you&#8217;ve got the fields added to the database, it&#8217;s time to upload some files. <a href="http://www.reloadedpc.com/wp-content/uploads/2009/12/related_products.zip">Download Zencart Related Plugins</a>. Read the included readme file, and upload to your zen cart folder.</p>
<p>Open the file /includes/templates/CUSTOM/templates/tpl_product_info_display.php and find the block around line 463:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;!--bof also purchased products module --&gt;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$template</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_template_dir</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tpl_modules_also_purchased_products.php'</span><span style="color: #339933;">,</span> DIR_WS_TEMPLATE<span style="color: #339933;">,</span> <span style="color: #000088;">$current_page_base</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'templates'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'/'</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'tpl_modules_also_purchased_products.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!--eof also purchased products module --&gt;</pre></div></div>

<p>Above that copy this into your file:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;!--bof also related products module--&gt;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$template</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_template_dir</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tpl_modules_related_products.php'</span><span style="color: #339933;">,</span> DIR_WS_TEMPLATE<span style="color: #339933;">,</span> <span style="color: #000088;">$current_page_base</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'templates'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'/'</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'tpl_modules_related_products.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!--eof also related products module--&gt;</pre></div></div>

<p>You should now see products being displayed under the products description.	You will want to add some CSS styles to the box to your liking. Default styles should be:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#relatedProducts</span>	<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.centerBoxContentsRelatedProduct</span>	<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1em</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.reloadedpc.com/zen-cart/zencart-related-products/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)
Database Caching 4/12 queries in 0.008 seconds using disk

Served from: www.reloadedpc.com @ 2010-09-07 09:09:28 -->