<?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>nothing is clear</title>
	<atom:link href="http://www.nothingisclear.net/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.nothingisclear.net</link>
	<description>// a blog about web programming</description>
	<lastBuildDate>Tue, 30 Mar 2010 10:11:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Check if cookie are enabled in PHP</title>
		<link>http://www.nothingisclear.net/?p=69</link>
		<comments>http://www.nothingisclear.net/?p=69#comments</comments>
		<pubDate>Tue, 30 Mar 2010 10:11:46 +0000</pubDate>
		<dc:creator>elmisi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[quantaltro]]></category>

		<guid isPermaLink="false">http://www.nothingisclear.net/?p=69</guid>
		<description><![CDATA[
function isCookieEnabled()
{
    return (isset($_COOKIE[ini_get('session.name')])
            &#38;&#38; strlen($_COOKIE[ini_get('session.name')])&#62;0);
}
]]></description>
			<content:encoded><![CDATA[<pre class="brush: php;">
function isCookieEnabled()
{
    return (isset($_COOKIE[ini_get('session.name')])
            &amp;&amp; strlen($_COOKIE[ini_get('session.name')])&gt;0);
}
</pre>]]></content:encoded>
			<wfw:commentRss>http://www.nothingisclear.net/?feed=rss2&amp;p=69</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Including a php file into a string</title>
		<link>http://www.nothingisclear.net/?p=55</link>
		<comments>http://www.nothingisclear.net/?p=55#comments</comments>
		<pubDate>Thu, 25 Mar 2010 20:14:45 +0000</pubDate>
		<dc:creator>ensaimado</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.nothingisclear.net/?p=55</guid>
		<description><![CDATA[&#8230; Because there will be times in which you may want to include the contents of a php file into a variable.

	function get_include_contents($filename) {

	    if (is_file($filename)) {
	        ob_start();
	        include $filename;
	        $contents [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230; Because there will be times in which you may want to include the contents of a php file into a variable.</p>
<pre class="brush: php;">
	function get_include_contents($filename) {

	    if (is_file($filename)) {
	        ob_start();
	        include $filename;
	        $contents = ob_get_contents();
	        ob_end_clean();
	        return $contents;
	    }
	    return false;
	}
</pre>
<p>I have edited my post to answer  dave&#8217;s comment below.	</p>
<p>By looking at this funciton you may think it&#8217;s just a substitute of file_get_contents().<br />
The difference is that file_get_contents will return literaly the contents of the file, as opposed to get_include_contents that will actually run the code,<br />
and because we are turning on output buffering, we can get the output of the script and store it in a string. For example if we have the php file &#8216;example.php&#8217;:</p>
<pre class="brush: php;">

	echo 'The gamma laser toxic spill gave me powers';
</pre>
<p>file_get_contents will produce the following result:</p>
<pre class="brush: php;">

	$string = file_get_contents('example.php');

	echo $string;
	// will output: echo 'The gamma laser toxic spill gave me powers';
</pre>
<p>If we use get_include_contents() instead, it will produce the following result:</p>
<pre class="brush: php;">

	$string = get_include_contents('example.php');

	echo $string;
	// will output: The gamma laser toxic spill gave me powers
</pre>
<p>If you are still thinking why would I want to do this, I will give you a real life example to ilustrate:	</p>
<p>Lets assume that you have the following  email template in a file template.php:</p>
<pre class="brush: php;">

echo  'Dear Mr. ' . $params['name'] . ',';
echo  'All your ' . $params['item'] . ' are belong to us!';
</pre>
<p>The function could then be extended to accept some paramaters that the template will need to have on scope:</p>
<pre class="brush: php;">
	function get_include_contents($filename, $params) {

	    if (is_file($filename)) {
	        ob_start();
	        include $filename;
	        $contents = ob_get_contents();
	        ob_end_clean();
	        return $contents;
	    }
	    return false;
	}
</pre>
<p>After that we can send an email using template.php like this:</p>
<pre class="brush: php;">

	$html_email = get_include_contents(
							   'example.php'
							   array(
								   'name'  =&gt;; 'Satan',
							           'item'  =&gt; 'Snakes'
								  )
							);

	mail('someemail@blah.com', 'Subject', $html_email);	
</pre>
<p>The recipient of the email will have a message in his inbox saying:</p>
<pre class="brush: plain;">

Dear Mr. Satan,
All your snakes are belong to us!
</pre>]]></content:encoded>
			<wfw:commentRss>http://www.nothingisclear.net/?feed=rss2&amp;p=55</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>I&#8217;ve already been writing about how muc&#8230;</title>
		<link>http://www.nothingisclear.net/?p=54</link>
		<comments>http://www.nothingisclear.net/?p=54#comments</comments>
		<pubDate>Thu, 25 Mar 2010 18:05:37 +0000</pubDate>
		<dc:creator>reecoo</dc:creator>
				<category><![CDATA[status]]></category>
		<category><![CDATA[18-columns]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[fluidgrid]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[ui]]></category>

		<guid isPermaLink="false">http://www.nothingisclear.net/?p=54</guid>
		<description><![CDATA[I&#8217;ve already been writing about how much i love fluid layouts in this post so i&#8217;ll be quick this time.
How to tranform the 6/9 fluidgrid system from newgoldleaf into an 18 columns one&#8230; ?
not a big deal,
but it&#8217;s always easier to find something to copy and paste, isn&#8217;t it?
1) download fluidgrid system from newgoldleaf
2) add [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve already been writing about how much i love fluid layouts in <a href="http://www.aboutme.it/2010/03/07/18-columns-fluid-grid-layout/" target="_blank">this post</a> so i&#8217;ll be quick this time.</p>
<p>How to tranform the 6/9 <a href="http://fluid.newgoldleaf.com/">fluidgrid system from newgoldleaf</a> into an 18 columns one&#8230; ?<br />
not a big deal,<br />
but it&#8217;s always easier to find something to copy and paste, isn&#8217;t it?</p>
<p>1) <a href="http://fluid.newgoldleaf.com/">download fluidgrid</a> system from newgoldleaf<br />
2) add these lines of code into fluid.gs.css<br />
3) enjoy!</p>
<pre class="brush: css;">
div.eighteen_column.section div.one {width:5%;}
div.eighteen_column.section div.two {width:10%;}
div.eighteen_column.section div.three {width:15%;}
div.eighteen_column.section div.four {width:20%;}
div.eighteen_column.section div.five {width:25%;}
div.eighteen_column.section div.six {width:30%;}
div.eighteen_column.section div.seven {width:35%;}
div.eighteen_column.section div.eight {width:40%;}
div.eighteen_column.section div.nine {width:45%;}
div.eighteen_column.section div.ten {width:50%;}
div.eighteen_column.section div.eleven {width:55%;}
div.eighteen_column.section div.twelve {width:60%;}
div.eighteen_column.section div.thirteen {width:65%;}
div.eighteen_column.section div.fourteen {width:70%;}
div.eighteen_column.section div.fifteen {width:75%;}
div.eighteen_column.section div.sixteen {width:80%;}
div.eighteen_column.section div.seventeen {width:85%;}
div.eighteen_column.section div.eighteen {width:90%;}
</pre>]]></content:encoded>
			<wfw:commentRss>http://www.nothingisclear.net/?feed=rss2&amp;p=54</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PEAR behind an authenticated proxy</title>
		<link>http://www.nothingisclear.net/?p=50</link>
		<comments>http://www.nothingisclear.net/?p=50#comments</comments>
		<pubDate>Thu, 25 Mar 2010 14:39:30 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[post]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[proxy]]></category>

		<guid isPermaLink="false">http://www.nothingisclear.net/?p=50</guid>
		<description><![CDATA[Do you need to use PEAR, but you are behind a proxy that requires authentication?
Use this command to set the correct values:
pear config-set http_proxy http://username:password@proxyhost:port]]></description>
			<content:encoded><![CDATA[<p>Do you need to use PEAR, but you are behind a proxy that requires authentication?<br />
Use this command to set the correct values:</p>
<pre>pear config-set http_proxy <a href="http://username:password@proxyhost:port" rel="nofollow">http://username:password@proxyhost:port</a></pre>]]></content:encoded>
			<wfw:commentRss>http://www.nothingisclear.net/?feed=rss2&amp;p=50</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Another slugify method for php</title>
		<link>http://www.nothingisclear.net/?p=47</link>
		<comments>http://www.nothingisclear.net/?p=47#comments</comments>
		<pubDate>Wed, 24 Mar 2010 14:21:13 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[post]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[slug]]></category>
		<category><![CDATA[string]]></category>

		<guid isPermaLink="false">http://www.nothingisclear.net/?p=47</guid>
		<description><![CDATA[One more way to slugify texts in php, without the need of the iconv() function:

    public static function slugify($text) {
		$text = trim($text);
		$text = str_replace(&#34;.&#34;, &#34;&#34;, $text);
		$text = self::removeAccents($text);
		// replace non letter or digits by -
		$text = preg_replace('~[^\\pL\d]+~u', '-', $text);
		// trim
		$text = trim($text, '-');
		// lowercase
		$text = strtolower($text);
		// remove unwanted characters
		$text = preg_replace('~[^-\w]+~', '', [...]]]></description>
			<content:encoded><![CDATA[<p>One more way to slugify texts in php, without the need of the iconv() function:</p>
<pre class="brush: php;">
    public static function slugify($text) {
		$text = trim($text);
		$text = str_replace(&quot;.&quot;, &quot;&quot;, $text);
		$text = self::removeAccents($text);
		// replace non letter or digits by -
		$text = preg_replace('~[^\\pL\d]+~u', '-', $text);
		// trim
		$text = trim($text, '-');
		// lowercase
		$text = strtolower($text);
		// remove unwanted characters
		$text = preg_replace('~[^-\w]+~', '', $text);
		return $text;

	}

	public static function removeAccents($text) {
		$text = htmlentities(utf8_decode($text));
		$remove = array(&quot;&amp;amp;&quot;, &quot;acute&quot;, &quot;grave&quot;, &quot;circ&quot;, &quot;tilde&quot;, &quot;uml&quot;);
		$text = str_replace($remove, &quot;&quot;, $text);
		return $text;
	}
</pre>
<p>Put it inside an Utils class, and use it like</p>
<pre class="brush: php;">
$slug = Utils::slugify(&quot;nothingisclear is awesome&quot;);
</pre>]]></content:encoded>
			<wfw:commentRss>http://www.nothingisclear.net/?feed=rss2&amp;p=47</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I really don&#8217;t remember if i wrote it o&#8230;</title>
		<link>http://www.nothingisclear.net/?p=44</link>
		<comments>http://www.nothingisclear.net/?p=44#comments</comments>
		<pubDate>Tue, 23 Mar 2010 21:55:40 +0000</pubDate>
		<dc:creator>reecoo</dc:creator>
				<category><![CDATA[status]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[slug]]></category>
		<category><![CDATA[string]]></category>

		<guid isPermaLink="false">http://www.nothingisclear.net/?p=44</guid>
		<description><![CDATA[I really don&#8217;t remember if i&#8217;ve written this or took it from someone on the web (if you recognize it, please let me know, or just know that i didn&#8217;t want to steal it :) ).
Anyway today i was into slugs and i surprisingly found a php simple-and-working static method for converting strings into slugs [...]]]></description>
			<content:encoded><![CDATA[<p>I really don&#8217;t remember if i&#8217;ve written this or took it from someone on the web (if you recognize it, please let me know, or just know that i didn&#8217;t want to steal it :) ).</p>
<p>Anyway today i was into slugs and i surprisingly found a php <u>simple-and-working static method for converting strings into slugs</u> and i felt like sharing it:</p>
<pre class="brush: php;">
/**
 * PHP &quot;iconv&quot; REQUIRED !!!
 * @param object $string
 * @param object $space [optional]
 * @return
 */

public static function convertStringIntoSlug($string,$space=&quot;-&quot;) {  

	if (function_exists('iconv')) {
        $string = @iconv('UTF-8', 'ASCII//TRANSLIT', $string);
    }  

    $string = strtolower(preg_replace(&quot;/[^a-zA-Z0-9 -]/&quot;,&quot;&quot;, $string));
    $string = str_replace(&quot; &quot;, $space, $string);

    return $string;

}
</pre>
<p><a href="http://www.nothingisclear.net/?p=37">here</a> i&#8217;ve already wrote about a good jquery alternative (written by Leo Caseiro) for doing this</p>]]></content:encoded>
			<wfw:commentRss>http://www.nothingisclear.net/?feed=rss2&amp;p=44</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>really good menu for showing hierarchica&#8230;</title>
		<link>http://www.nothingisclear.net/?p=38</link>
		<comments>http://www.nothingisclear.net/?p=38#comments</comments>
		<pubDate>Tue, 23 Mar 2010 21:23:33 +0000</pubDate>
		<dc:creator>reecoo</dc:creator>
				<category><![CDATA[status]]></category>
		<category><![CDATA[hierarchical]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[menu]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[ui]]></category>

		<guid isPermaLink="false">http://www.nothingisclear.net/?p=38</guid>
		<description><![CDATA[really good menu (filament group calls it &#8220;iPod style&#8221;) for showing hierarchical data (i&#8217;m using it for showing categories in a backEnd).
Needs couple of adjustments here and there&#8230;.
if you&#8217;ve spotted a better one, please, let me know.]]></description>
			<content:encoded><![CDATA[<p>really good <a href="http://www.filamentgroup.com/lab/jquery_ipod_style_and_flyout_menus/" target="_blank">menu</a> (filament group calls it &#8220;iPod style&#8221;) for showing hierarchical data (i&#8217;m using it for showing categories in a backEnd).</p>
<p><u>Needs couple of adjustments</u> here and there&#8230;.<br />
if you&#8217;ve spotted a better one, please, let me know.</p>]]></content:encoded>
			<wfw:commentRss>http://www.nothingisclear.net/?feed=rss2&amp;p=38</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>a really good link for a jquery plugin t&#8230;</title>
		<link>http://www.nothingisclear.net/?p=37</link>
		<comments>http://www.nothingisclear.net/?p=37#comments</comments>
		<pubDate>Tue, 23 Mar 2010 20:52:00 +0000</pubDate>
		<dc:creator>reecoo</dc:creator>
				<category><![CDATA[status]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[slug]]></category>
		<category><![CDATA[stringToSlug]]></category>

		<guid isPermaLink="false">http://www.nothingisclear.net/?p=37</guid>
		<description><![CDATA[a really good link for a jquery plugin to transform strings into slugs&#8230;.also transforming accents, umlauts, and other special letters in the right way.
name of the plugin: jquery.stringToSlug.js (written by Leo Caseiro)]]></description>
			<content:encoded><![CDATA[<p><a href="http://leocaseiro.com.br/jquery-plugin-string-to-slug/" target="_blank">a really good link</a> for a jquery plugin to transform strings into slugs&#8230;.also transforming accents, umlauts, and other special letters in the right way.</p>
<p>name of the plugin: <a href="http://leocaseiro.com.br/jquery-plugin-string-to-slug/" target="_blank">jquery.stringToSlug.js</a> (written by Leo Caseiro)</p>]]></content:encoded>
			<wfw:commentRss>http://www.nothingisclear.net/?feed=rss2&amp;p=37</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>hello world!</title>
		<link>http://www.nothingisclear.net/?p=34</link>
		<comments>http://www.nothingisclear.net/?p=34#comments</comments>
		<pubDate>Tue, 23 Mar 2010 20:40:35 +0000</pubDate>
		<dc:creator>reecoo</dc:creator>
				<category><![CDATA[status]]></category>

		<guid isPermaLink="false">http://www.nothingisclear.net/?p=34</guid>
		<description><![CDATA[hello world!]]></description>
			<content:encoded><![CDATA[<p>hello world!</p>]]></content:encoded>
			<wfw:commentRss>http://www.nothingisclear.net/?feed=rss2&amp;p=34</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
