<?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>12 Stix - Tech Answers and Fixes &#187; php</title>
	<atom:link href="http://12stix.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://12stix.com</link>
	<description>Tech Answers and Fixes</description>
	<lastBuildDate>Tue, 11 Oct 2011 12:20:00 +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>PHP: Write to a file</title>
		<link>http://12stix.com/2011/07/07/php-write-to-a-file/</link>
		<comments>http://12stix.com/2011/07/07/php-write-to-a-file/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 15:38:26 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://12stix.com/?p=407</guid>
		<description><![CDATA[The following code writes to a file, it will overwrite the current contents of the file: $string = "file contents goes here"; $myFile = "file.php"; $fh = fopen($myFile, 'w') or die("can't open file"); fwrite($fh, $string); fclose($fh); Make sure you give file.php write access on the server (Apache chmod 775 normally works).]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>The following code writes to a file, it will overwrite the current contents of the file:</p>
<p><code><br />
$string = "file contents goes here";<br />
$myFile = "file.php";<br />
$fh = fopen($myFile, 'w') or die("can't open file");<br />
fwrite($fh, $string);<br />
fclose($fh);<br />
</code></p>
<p>Make sure you give file.php write access on the server (Apache chmod 775 normally works).</p>
<div class="shr-publisher-407"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://12stix.com/2011/07/07/php-write-to-a-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: Limit a strings characters</title>
		<link>http://12stix.com/2011/07/07/php-limit-a-strings-characters/</link>
		<comments>http://12stix.com/2011/07/07/php-limit-a-strings-characters/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 15:36:47 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://12stix.com/?p=405</guid>
		<description><![CDATA[This function will limit the number of words shown if the total character limit is over a certain number and add &#8230; after the string. Very useful if you want to trim titles or anywhere where you are limited by space: function limitCharacters($string){ $count = strlen($string); // change 50 to the number of characters you [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>This function will limit the number of words shown if the total character limit is over a certain number and add &#8230; after the string. Very useful if you want to trim titles or anywhere where you are limited by space:</p>
<p><code><br />
function limitCharacters($string){<br />
	$count = strlen($string);<br />
        // change 50 to the number of characters you want to check for<br />
	if($count > 50){<br />
                //change 5 to the number of words you want to limit to.<br />
                //change ... to anything you want to use to show its clipped<br />
		$newstring = implode(' ',array_slice(explode(' ',$string),0,5)).'...';<br />
	}else{<br />
		$newstring = $string;<br />
	}<br />
	return $newstring;<br />
}<br />
</code></p>
<p>To call the function simply use:<br />
<code><br />
limitCharacters($mystring);<br />
</code></p>
<div class="shr-publisher-405"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://12stix.com/2011/07/07/php-limit-a-strings-characters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find out PHP Version installed from Command Line</title>
		<link>http://12stix.com/2011/06/23/find-out-php-version-installed-from-command-line/</link>
		<comments>http://12stix.com/2011/06/23/find-out-php-version-installed-from-command-line/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 10:54:35 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://12stix.com/?p=394</guid>
		<description><![CDATA[At the prompt type: php -v]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>At the prompt type:</p>
<p>php -v</p>
<div class="shr-publisher-394"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://12stix.com/2011/06/23/find-out-php-version-installed-from-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP 5 Not Showing Errors</title>
		<link>http://12stix.com/2010/09/20/php-5-not-showing-errors/</link>
		<comments>http://12stix.com/2010/09/20/php-5-not-showing-errors/#comments</comments>
		<pubDate>Mon, 20 Sep 2010 09:21:24 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://12stix.com/?p=319</guid>
		<description><![CDATA[Above your script add in the following line:]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Above your script add in the following line:</p>
<p><?php<br />
ini_set('display_errors', 'On');<br />
?></p>
<div class="shr-publisher-319"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://12stix.com/2010/09/20/php-5-not-showing-errors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal CCK Autonumber Field</title>
		<link>http://12stix.com/2009/01/05/drupal-cck-autonumber-field/</link>
		<comments>http://12stix.com/2009/01/05/drupal-cck-autonumber-field/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 16:24:14 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://12stix.com/?p=158</guid>
		<description><![CDATA[In a Drupal site you may have a content type that needs an auto number to be generated that auto increments on each new node of that type. To do this install the computed field module http://drupal.org/project/computed_field Then create a new field of the type computed field and add the code from the following URL [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>In a Drupal site you may have a content type that needs an auto number to be generated that auto increments on each new node of that type.</p>
<p>To do this install the computed field module</p>
<p>http://drupal.org/project/computed_field</p>
<p>Then create a new field of the type computed field and add the code from the following URL</p>
<p>http://drupal.org/node/313110</p>
<div class="shr-publisher-158"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://12stix.com/2009/01/05/drupal-cck-autonumber-field/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Display a Random Image from a Folder</title>
		<link>http://12stix.com/2008/10/21/display-a-random-image-from-a-folder/</link>
		<comments>http://12stix.com/2008/10/21/display-a-random-image-from-a-folder/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 13:32:26 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://12stix.com/?p=87</guid>
		<description><![CDATA[If you need to display a random image from a folder on your website then this tutorial may be of use http://www.reconn.us/random_file.html It&#8217;s very easy to follow and you can set it up in minutes.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>If you need to display a random image from a folder on your website then this tutorial may be of use</p>
<p>http://www.reconn.us/random_file.html</p>
<p>It&#8217;s very easy to follow and you can set it up in minutes.</p>
<div class="shr-publisher-87"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://12stix.com/2008/10/21/display-a-random-image-from-a-folder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Increase the memory available to PHP</title>
		<link>http://12stix.com/2008/10/08/increase-the-memory-available-to-php/</link>
		<comments>http://12stix.com/2008/10/08/increase-the-memory-available-to-php/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 10:32:38 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://12stix.com/?p=41</guid>
		<description><![CDATA[If you get out of memory errors in PHP or if Drupal suggests you increase the memory available to PHP then you can do this with the following line of code: ini_set(&#039;memory_limit&#039;,&#039;16M&#039;); In Drupal the best place to put this is in the settings.php file found in sites/default/]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>If you get out of memory errors in PHP or if Drupal suggests you increase the memory available to PHP then you can do this with the following line of code:</p>
<p><span><span class="func">
<pre class="brush: php">ini_set(&#039;memory_limit&#039;,&#039;16M&#039;);</pre>
<p></span></span></p>
<p>In Drupal the best place to put this is in the settings.php file found in sites/default/</p>
<div class="shr-publisher-41"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://12stix.com/2008/10/08/increase-the-memory-available-to-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

