<?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>Web Citizen Magazine</title>
	<atom:link href="http://www.webcitizenmag.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webcitizenmag.com</link>
	<description>Web Design Tutorials &#38; Tips: HTML, CSS, PHP, Wordpress, jQuery, Expression Engine, SEO and more</description>
	<lastBuildDate>Wed, 19 Oct 2011 03:51:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1-RC3</generator>
		<item>
		<title>MySQLi OOP connection example PHP</title>
		<link>http://www.webcitizenmag.com/2011/05/05/mysqli-oop-connection-example-php/</link>
		<comments>http://www.webcitizenmag.com/2011/05/05/mysqli-oop-connection-example-php/#comments</comments>
		<pubDate>Thu, 05 May 2011 03:10:31 +0000</pubDate>
		<dc:creator>thecitizen</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.webcitizenmag.com/?p=243</guid>
		<description><![CDATA[$mysqli = new mysqli(&#34;localhost&#34;, &#34;my_user&#34;, &#34;my_password&#34;, &#34;world&#34;); if (mysqli_connect_errno()) { printf(&#34;Connect failed: %s\n&#34;, mysqli_connect_error()); exit(); } $query = &#34;SELECT * FROM users WHERE user_id='$userid'&#34;; if ($result = $mysqli-&#62;query($query)) { while ($row = $result-&#62;fetch_assoc()) { echo $row['name'] .&#34;&#60;br /&#62;&#34;; } $result-&#62;close(); &#8230; <a href="http://www.webcitizenmag.com/2011/05/05/mysqli-oop-connection-example-php/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<pre class="brush: php;">

$mysqli = new mysqli(&quot;localhost&quot;, &quot;my_user&quot;, &quot;my_password&quot;, &quot;world&quot;);

if (mysqli_connect_errno())
{
   printf(&quot;Connect failed: %s\n&quot;, mysqli_connect_error());
   exit();
}

$query = &quot;SELECT * FROM users WHERE user_id='$userid'&quot;;

if ($result = $mysqli-&gt;query($query))
{
   while ($row = $result-&gt;fetch_assoc())
   {
       echo $row['name'] .&quot;&lt;br /&gt;&quot;;
   }
   $result-&gt;close();
}

$mysqli-&gt;close();
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.webcitizenmag.com/2011/05/05/mysqli-oop-connection-example-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recursive Functions in PHP (Simple Examples)</title>
		<link>http://www.webcitizenmag.com/2011/05/04/recursive-functions-in-php-simple-examples/</link>
		<comments>http://www.webcitizenmag.com/2011/05/04/recursive-functions-in-php-simple-examples/#comments</comments>
		<pubDate>Wed, 04 May 2011 01:08:51 +0000</pubDate>
		<dc:creator>thecitizen</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.webcitizenmag.com/?p=237</guid>
		<description><![CDATA[A recursive function is a regular function which calls itself.. // Factorial example (ie 5 * 4 * 3 * 2 * 1) function factorial($n) { if ($n == 1) return 1; return $n * factorial($n-1); } echo factorial(5); // &#8230; <a href="http://www.webcitizenmag.com/2011/05/04/recursive-functions-in-php-simple-examples/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A recursive function is a regular function which calls itself..</p>
<pre class="brush: php;">

// Factorial example (ie 5 * 4 * 3 * 2 * 1)
function factorial($n) {

	if ($n == 1) return 1;
	return $n * factorial($n-1);

}

echo factorial(5); // Outputs 120
</pre>
<pre class="brush: php;">

// Nested Array Summing Example
$example = array(1, 2, array(10,20,30), 4);

function sum_array($array) {

	$total = 0;
	foreach ($array as $element) {
		if(is_array($element)) {
			$total += sum_array($element);
		} else {
			$total += $element;
		}
	}
	return $total;

}
echo sum_array($example); // Outputs 67
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.webcitizenmag.com/2011/05/04/recursive-functions-in-php-simple-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Switch Statement PHP (Simple Example)</title>
		<link>http://www.webcitizenmag.com/2011/05/04/switch-statement-php-simple-example/</link>
		<comments>http://www.webcitizenmag.com/2011/05/04/switch-statement-php-simple-example/#comments</comments>
		<pubDate>Wed, 04 May 2011 00:49:27 +0000</pubDate>
		<dc:creator>thecitizen</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.webcitizenmag.com/?p=235</guid>
		<description><![CDATA[$i = 1; switch($i) { case 0: echo 'i equals 0'; break; case 1: echo 'i equals 1'; break; default: echo 'i equals the default value'; }]]></description>
			<content:encoded><![CDATA[<pre class="brush: php;">

$i = 1;
switch($i) {

 case 0:
 echo 'i equals 0';
 break;

 case 1:
 echo 'i equals 1';
 break;

 default:
 echo 'i equals the default value';

}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.webcitizenmag.com/2011/05/04/switch-statement-php-simple-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Do-While Statement PHP (Simple Example)</title>
		<link>http://www.webcitizenmag.com/2011/05/04/do-while-statement-php-simple-example/</link>
		<comments>http://www.webcitizenmag.com/2011/05/04/do-while-statement-php-simple-example/#comments</comments>
		<pubDate>Wed, 04 May 2011 00:42:56 +0000</pubDate>
		<dc:creator>thecitizen</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.webcitizenmag.com/?p=233</guid>
		<description><![CDATA[$i = 0; do { echo $i++; } while ($i &#60;= 10);]]></description>
			<content:encoded><![CDATA[<pre class="brush: php;">
$i = 0;
do { echo $i++; } while ($i &lt;= 10);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.webcitizenmag.com/2011/05/04/do-while-statement-php-simple-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>While Statement in PHP (Simple Example)</title>
		<link>http://www.webcitizenmag.com/2011/05/04/while-statement-in-php-simple-example/</link>
		<comments>http://www.webcitizenmag.com/2011/05/04/while-statement-in-php-simple-example/#comments</comments>
		<pubDate>Wed, 04 May 2011 00:38:59 +0000</pubDate>
		<dc:creator>thecitizen</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.webcitizenmag.com/?p=228</guid>
		<description><![CDATA[$i = 0; while ($i &#60;= 10) { echo $i++; }]]></description>
			<content:encoded><![CDATA[<pre class="brush: php;">
$i = 0;
while ($i &lt;= 10) {

echo $i++;

}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.webcitizenmag.com/2011/05/04/while-statement-in-php-simple-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>For Loop vs Foreach Loop in PHP (Simple Example)</title>
		<link>http://www.webcitizenmag.com/2011/05/03/for-loop-vs-foreach-loop-in-php-simple-example/</link>
		<comments>http://www.webcitizenmag.com/2011/05/03/for-loop-vs-foreach-loop-in-php-simple-example/#comments</comments>
		<pubDate>Tue, 03 May 2011 11:13:50 +0000</pubDate>
		<dc:creator>thecitizen</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.webcitizenmag.com/?p=218</guid>
		<description><![CDATA[// For Loop for ($i = 1; $i &#60;= 10; $i++) { echo $i; } // Foreach Loop $array = array(&#34;sample&#34; =&#62; &#34;value&#34;, &#34;sample2&#34; =&#62; &#34;value2&#34;, &#34;sample3&#34; =&#62; &#34;value3&#34;); foreach ($array as $key =&#62; $val) { echo $key  . ': &#8230; <a href="http://www.webcitizenmag.com/2011/05/03/for-loop-vs-foreach-loop-in-php-simple-example/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<pre class="brush: php;">

// For Loop

for ($i = 1; $i &lt;= 10; $i++) {

echo $i;

}
</pre>
<pre class="brush: php;">

// Foreach Loop

$array = array(&quot;sample&quot; =&gt; &quot;value&quot;, &quot;sample2&quot; =&gt; &quot;value2&quot;, &quot;sample3&quot; =&gt; &quot;value3&quot;);

foreach ($array as $key =&gt; $val) {

echo $key  . ': ' .  $value . '&lt;br /&gt;';

}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.webcitizenmag.com/2011/05/03/for-loop-vs-foreach-loop-in-php-simple-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress get_the_content function no paragraph tags</title>
		<link>http://www.webcitizenmag.com/2011/04/20/wordpress-get_the_content-function-no-paragraph-tags/</link>
		<comments>http://www.webcitizenmag.com/2011/04/20/wordpress-get_the_content-function-no-paragraph-tags/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 14:41:33 +0000</pubDate>
		<dc:creator>thecitizen</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.webcitizenmag.com/?p=213</guid>
		<description><![CDATA[Did you just use the WordPress get_the_content function and realize that all of the line breaks from the visual editor are not being returned as paragraph tags? Solution: Apply the appropriate filters as outlined in the WordPress codex&#8230; &#60;?php $content &#8230; <a href="http://www.webcitizenmag.com/2011/04/20/wordpress-get_the_content-function-no-paragraph-tags/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Did you just use the WordPress get_the_content function and realize that all of the line breaks from the visual editor are not being returned as paragraph tags?</p>
<p>Solution: Apply the appropriate filters as outlined in the <a href="http://codex.wordpress.org/Template_Tags/the_content#Alternative_Usage" target="_blank">WordPress codex</a>&#8230;</p>
<pre class="brush: php;">
&lt;?php
$content = get_the_content();
$content = apply_filters('the_content', $content);
$content = str_replace(']]&gt;', ']]&amp;gt;', $content);

echo $content; ?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.webcitizenmag.com/2011/04/20/wordpress-get_the_content-function-no-paragraph-tags/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Get current index position in loop in WordPress</title>
		<link>http://www.webcitizenmag.com/2011/04/18/get-current-index-position-in-loop-in-wordpress/</link>
		<comments>http://www.webcitizenmag.com/2011/04/18/get-current-index-position-in-loop-in-wordpress/#comments</comments>
		<pubDate>Mon, 18 Apr 2011 16:25:14 +0000</pubDate>
		<dc:creator>thecitizen</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.webcitizenmag.com/?p=207</guid>
		<description><![CDATA[Need to get the current index position while iterating through a WordPress loop? Simple&#8230; just use $wp_query-&#62;current_post Here&#8217;s a very stripped down example loop. Note the output starts at 0 (ie 0, 1, 2, 3&#8230;) &#60;?php while (have_posts()) : the_post(); &#8230; <a href="http://www.webcitizenmag.com/2011/04/18/get-current-index-position-in-loop-in-wordpress/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Need to get the current index position while iterating through a WordPress loop? Simple&#8230; just use<strong> $wp_query-&gt;current_post</strong></p>
<p>Here&#8217;s a very stripped down example loop. Note the output <em>starts at 0</em> (ie 0, 1, 2, 3&#8230;)<strong><br />
</strong></p>
<pre class="brush: php;">

&lt;?php while (have_posts()) : the_post();

// Some basic wordpress template tags
the_title();
the_content();

// Echo the current index position of the loop (0,1,2,3..etc)
echo $wp_query-&gt;current_post;

endwhile;?&gt;
</pre>
<p><strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.webcitizenmag.com/2011/04/18/get-current-index-position-in-loop-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Get image path in child theme in WordPress</title>
		<link>http://www.webcitizenmag.com/2011/04/18/get-image-path-in-child-theme-in-wordpress/</link>
		<comments>http://www.webcitizenmag.com/2011/04/18/get-image-path-in-child-theme-in-wordpress/#comments</comments>
		<pubDate>Mon, 18 Apr 2011 14:28:22 +0000</pubDate>
		<dc:creator>thecitizen</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.webcitizenmag.com/?p=200</guid>
		<description><![CDATA[To get an image path (or any other file for that matter) inside your child theme in WordPress you can use the get_bloginfo function with the &#8220;stylesheet_directory&#8221; parameter. &#60;img src=&#34;&#60;?php echo get_bloginfo('stylesheet_directory'); ?&#62;/yourpath/to/an/imagefile.jpg&#34; id=&#34;my-new-image&#34; alt=&#34;My New Image&#34; /&#62;]]></description>
			<content:encoded><![CDATA[<p>To get an image path (or any other file for that matter) inside your child theme in WordPress you can use the get_bloginfo function with the &#8220;stylesheet_directory&#8221; parameter.</p>
<pre class="brush: php;">

&lt;img src=&quot;&lt;?php echo get_bloginfo('stylesheet_directory'); ?&gt;/yourpath/to/an/imagefile.jpg&quot; id=&quot;my-new-image&quot; alt=&quot;My New Image&quot; /&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.webcitizenmag.com/2011/04/18/get-image-path-in-child-theme-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove &#8220;comments are closed&#8221; from a WordPress theme</title>
		<link>http://www.webcitizenmag.com/2010/10/12/remove-comments-are-closed-from-a-wordpress-theme/</link>
		<comments>http://www.webcitizenmag.com/2010/10/12/remove-comments-are-closed-from-a-wordpress-theme/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 15:09:48 +0000</pubDate>
		<dc:creator>thecitizen</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.webcitizenmag.com/?p=194</guid>
		<description><![CDATA[On a client&#8217;s site, needed to remove &#8220;comments are closed&#8221; from post/pages where comments have been manually disallowed (by the client on the bottom of the edit screen). Most blogs say just to remove the call to &#60;?php comments_template(); ?&#62; &#8230; <a href="http://www.webcitizenmag.com/2010/10/12/remove-comments-are-closed-from-a-wordpress-theme/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>On a client&#8217;s site, needed to remove &#8220;comments are closed&#8221; from post/pages where comments have been manually disallowed (by the client on the bottom of the edit screen).</p>
<p>Most blogs say just to remove the call to &lt;?php comments_template(); ?&gt; from your theme, but this removes comments <em>completely</em>. If you just want to remove/edit the message only where comments have been disabled, just find your comments.php file and scan the code for something that looks similar to this&#8230;</p>
<pre class="brush: php;">
	&lt;?php if ( comments_open() ) : ?&gt;
		&lt;!-- If comments are open, but there are no comments. --&gt;

	 &lt;?php else : // comments are closed ?&gt;
		&lt;!-- If comments are closed. --&gt;
		&lt;p class=&quot;nocomments&quot;&gt;Comments are closed.&lt;/p&gt;

	&lt;?php endif; ?&gt;
</pre>
<p class="note">*Note: its likely your code won&#8217;t be exactly the same, because each theme may have the comments template setup a little different. The basic idea is to find the &#8220;message&#8221; that you want to get rid of. In this example, the line we&#8217;re looking for is &#8220;&lt;p&gt;Comments are closed.&lt;/p&gt;&#8221;.</p>
<p>All we have to do now is just delete the following line..</p>
<pre class="brush: php;">&lt;p class=&quot;nocomments&quot;&gt;Comments are closed.&lt;/p&gt;</pre>
<p>And that&#8217;s it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webcitizenmag.com/2010/10/12/remove-comments-are-closed-from-a-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

