<?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/"
	>

<channel>
	<title>Frank Verhoeven</title>
	<atom:link href="http://www.frank-verhoeven.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.frank-verhoeven.com</link>
	<description>Webdevelopment Blog</description>
	<pubDate>Wed, 03 Dec 2008 20:45:28 +0000</pubDate>
	<generator>http://wordpress.org/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>FV Community News V1.2</title>
		<link>http://www.frank-verhoeven.com/fv-community-news-v12/</link>
		<comments>http://www.frank-verhoeven.com/fv-community-news-v12/#comments</comments>
		<pubDate>Fri, 31 Oct 2008 15:33:45 +0000</pubDate>
		<dc:creator>Frank Verhoeven</dc:creator>
		
		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://www.frank-verhoeven.com/?p=292</guid>
		<description><![CDATA[Finally, after a lot of programming the time is here. It&#8217;s the time for another update of my Community News plugin. This version includes a better way to protect you from being spammed, image uploading, edit submissions and more&#8230;

Spam Protection
While I was looking how my plugin works on different sites, I noticed that a lot [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.akismet.com/"><img src="http://www.frank-verhoeven.com/wp-content/uploads/2008/10/akismet.png" alt="Akismet" title="Akismet" width="225" height="126" class="float-right size-full wp-image-295" /></a><br />Finally, after a lot of programming the time is here. It&#8217;s the time for another update of my Community News plugin. This version includes a better way to protect you from being spammed, image uploading, edit submissions and more&#8230;<br />
<span id="more-292"></span></p>
<h2>Spam Protection</h2>
<p>While I was looking how my plugin works on different sites, I noticed that a lot of spam was coming through the default spam protection, build-in since version 1.1. (This means the default protection without captcha) Personally I hate those no-life spammers, throwing a whole lot of crap to your blog and from the beginning I use Akismet om my blog to protect myself, witch works pretty good. So I decided to build this great peace of spam-killing code into my plugin.<br />
To accomplish this I used the <a href="http://miphp.net/blog/view/php4_akismet_class">Akismet PHP4 class</a>, written by Bret Kuhns. Submissions will be marked as spam, just like comments, if Akismet finds a message to be spam. This way you can still approve submissions that aren&#8217;t spam, but are marked as if they are.</p>
<h2>Image Uploading</h2>
<p>Another new feature is the possibility to let submitters upload an image along with their submission. I received a request for this, and thought: &#8220;Hey that&#8217;s a good idea!&#8221;. The image field is not required, and therefor you could setup a default image that is used when people don&#8217;t upload one. You are also able to configure the maximum sizes for an image (width and height separated).<br />
Note that it could happen that you have to create the upload folder manually. If so, the plugin let you know. Just create a new folder in your WordPress root folder called &#8216;wp-fvcn-images&#8217;, then chmod it to 755 and everything should work fine.</p>
<p>To add the images to your list of submissions, you could use the new <strong>%submission_image%</strong> tag. This tag will change into the location of the image, so to add a new image, in its img tag use something like this:</p>
<pre class="html"><span class="htmlImageTag">&lt;img src=<span class="htmlAttributeValue">&quot;%submission_image%&quot;</span> alt=<span class="htmlAttributeValue">&quot;&quot;</span> /&gt;</span></pre>
<p>Note that when people upload an image they can&#8217;t use AJAX, because JavaScript can&#8217;t access the image. Here is taken care of automatically.</p>
<h2>My Submissions Page</h2>
<p>Want to let submitters view their own submissions? Now that is possible with the new &#8216;My Submissions&#8217; page. This is an optional page you could enable where registered users of your blog could view and submit their submissions.</p>
<h2>Edit Submissions</h2>
<p>I also received a request for this one. So from now on you can edit the submissions. Note that the &#8216;Edit Submissions&#8217; page is already created with and for WordPress 2.7. If you are using the 2.7 nightly-builds you won&#8217;t notice, but else you will see that the box with the Save button looks a bit crapy. I have thought a while about this one, but since 2.7 will be released within a few weeks, I think it isn&#8217;t worth the effort to make it look good in 2.6 and 2.5.</p>
<h2>Dashboard Widget</h2>
<p>Another 2.7+ feature is a dashboard widget. It looks almost the same as the comments widget and also has the same features. You could simply Approve, Unapprove, Spam or Delete a submission with one single click while your at the dashboard page.</p>
<h2>Other Fixes</h2>
<p>More little bug-fixes have been applied. A small list:</p>
<ul>
<li>The AJAX didn&#8217;t work when there was a ? in the URL, now it does work.</li>
<li>The settings page is separated in different tabs for a better usability.</li>
<li>Some problems with the function that shortens up the submission text are fixed.</li>
<li>You can now add a description if using the widgets.</li>
<li>The number of unmoderated submissions is added to the admin menu.</li>
<li>Link actions are added.</li>
<li>Some problems occurred when you have modified the location of your wp-content folder, this is fixed.</li>
<li>The &#8216;Post URL&#8217; field isn&#8217;t required anymore. (Had a request for this)</li>
<li>You now can override the template settings in your theme pages, instead of vice versa.</li>
<li>Some fixes are applied to the RSS feed.</li>
<li>Problems with the admin menu are fixed.</li>
<li>The reloading of the captcha is improved.</li>
</ul>
<p>That&#8217;s about it <img src='http://www.frank-verhoeven.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Any suggestions? Please leave a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.frank-verhoeven.com/fv-community-news-v12/feed/</wfw:commentRss>
		</item>
		<item>
		<title>FV Community News Version 1.1</title>
		<link>http://www.frank-verhoeven.com/fv-community-news-version-11/</link>
		<comments>http://www.frank-verhoeven.com/fv-community-news-version-11/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 15:05:31 +0000</pubDate>
		<dc:creator>Frank Verhoeven</dc:creator>
		
		<category><![CDATA[News]]></category>

		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://www.frank-verhoeven.com/?p=267</guid>
		<description><![CDATA[After one week of release, I already have a new version of my Community News plugin. This version has some improvements, new features, and some bug fixes:

The submission moderation panel is improved and some bugs are fixed.
The option that users must be logged in is added.
The form is already filled in in parts for users [...]]]></description>
			<content:encoded><![CDATA[<p>After one week of release, I already have a new version of my Community News plugin. This version has some improvements, new features, and some bug fixes:</p>
<ul>
<li>The submission moderation panel is improved and some bugs are fixed.</li>
<li>The option that users must be logged in is added.</li>
<li>The form is already filled in in parts for users who are logged in</li>
<li>The captcha could be removed for users who are already logged in.</li>
<li>The captcha image can now easily refreshed, using AJAX</li>
<li>A nonce field is added to fight spam.</li>
<li>I added an RSS 2.0 feed for the submissions.</li>
<li>AJAX is now used to submit the form.</li>
</ul>
<p>Note that all the JavaScript from this plugin uses the Prototype and Scriptaculous libraries, and if you already loaded jQuery in your page, the AJAX might not work.</p>
<h2>On to version 1.2</h2>
<p>There are already some suggestions for version 1.2:</p>
<ul>
<li>Allow people to upload photo&#8217;s.</li>
<li>The ability to edit submissions.</li>
<li>Tags to add Community News in a post or page.</li>
</ul>
<p>These will be implemented as soon as possible <img src='http://www.frank-verhoeven.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
Have any other suggestions? Please leave a comment and I will take a look at it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.frank-verhoeven.com/fv-community-news-version-11/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Create a RSS Feed with WordPress</title>
		<link>http://www.frank-verhoeven.com/create-an-rss-feed-with-wordpress/</link>
		<comments>http://www.frank-verhoeven.com/create-an-rss-feed-with-wordpress/#comments</comments>
		<pubDate>Mon, 06 Oct 2008 16:41:00 +0000</pubDate>
		<dc:creator>Frank Verhoeven</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.frank-verhoeven.com/?p=238</guid>
		<description><![CDATA[When you are busy creating a wonderful plugin for your WordPress blog, it might be possible that you need to create a RSS feed. For example, when creating a guestbook people could ask for a RSS feed to view the recent added posts and stay updated, or take a look at my own Community News [...]]]></description>
			<content:encoded><![CDATA[<p>When you are busy creating a wonderful plugin for your WordPress blog, it might be possible that you need to create a RSS feed. For example, when creating a guestbook people could ask for a RSS feed to view the recent added posts and stay updated, or take a look at my own <a href="http://www.frank-verhoeven.com/wordpress-plugin-fv-community-news/">Community News Plugin</a>, isn&#8217;t it great if it had a build-in RSS feed as well?</p>
<p>Well don&#8217;t worry I am busy to create that and it is almost finished. In the mean while, I wanted to share some stuff I learned while creating this RSS feed.</p>
<h2>The Beginning</h2>
<p>The first thing we need is a function that actually creates the RSS feed. This function doesn&#8217;t need any parameters and it also shouldn&#8217;t return anything.<br />
<span id="more-238"></span></p>
<pre class="php">
<span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span>
<span class="phpFunctionKeyword">function</span><span class="htmlText"> myGreatPluginRSSFeed</span><span class="phpOperator">(</span><span class="phpOperator">)</span> <span class="phpOperator">{</span>
    <span class="phpComment">// Function content goes here.
</span><span class="phpOperator">}</span>
<span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span>
</pre>
<p>This function must create the whole feed form the beginning to the end. So, you also have to include the xml/rss header. I ripped something from the default WordPress feed that should work for any blog.</p>
<pre class="php">
<span class="htmlOtherTag">&lt;rss version=<span class="htmlAttributeValue">&quot;2.0&quot;</span>
	xmlns:content=<span class="htmlAttributeValue">&quot;http://purl.org/rss/1.0/modules/content/&quot;</span>
	xmlns:dc=<span class="htmlAttributeValue">&quot;http://purl.org/dc/elements/1.1/&quot;</span>
	xmlns:atom=<span class="htmlAttributeValue">&quot;http://www.w3.org/2005/Atom&quot;</span>
	xmlns:sy=<span class="htmlAttributeValue">&quot;http://purl.org/rss/1.0/modules/syndication/&quot;</span>&gt;</span>
	<span class="htmlOtherTag">&lt;channel&gt;</span>
		<span class="htmlOtherTag">&lt;title&gt;</span><span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span><span class="htmlText"> bloginfo_rss</span><span class="phpOperator">(</span><span class="phpString">'name'</span><span class="phpOperator">)</span><span class="phpText">;</span><span class="htmlText"> wp_title_rss</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpText">;</span> <span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span><span class="htmlOtherTag">&lt;/title&gt;</span>
		<span class="htmlOtherTag">&lt;link&gt;</span><span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span><span class="htmlText"> bloginfo_rss</span><span class="phpOperator">(</span><span class="phpString">'url'</span><span class="phpOperator">)</span> <span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span><span class="htmlOtherTag">&lt;/link&gt;</span>
		<span class="htmlOtherTag">&lt;atom:link href=<span class="htmlAttributeValue">&quot;<span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span><span class="htmlText"> self_link</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpText">;</span> <span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span>&quot;</span> rel=<span class="htmlAttributeValue">&quot;self&quot;</span> type=<span class="htmlAttributeValue">&quot;application/rss+xml&quot;</span> /&gt;</span>
		<span class="htmlOtherTag">&lt;description&gt;</span><span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span><span class="htmlText"> bloginfo_rss</span><span class="phpOperator">(</span><span class="phpString">"description"</span><span class="phpOperator">)</span> <span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span><span class="htmlOtherTag">&lt;/description&gt;</span>
		<span class="htmlOtherTag">&lt;language&gt;</span><span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span> <span class="phpFunction">echo</span><span class="htmlText"> get_option</span><span class="phpOperator">(</span><span class="phpString">'rss_language'</span><span class="phpOperator">)</span><span class="phpText">;</span> <span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span><span class="htmlOtherTag">&lt;/language&gt;</span>
		<span class="htmlOtherTag">&lt;sy:updatePeriod&gt;</span><span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span> <span class="phpFunction">echo</span><span class="htmlText"> apply_filters</span><span class="phpOperator">(</span> <span class="phpString">'rss_update_period'</span><span class="phpText">,</span> <span class="phpString">'hourly'</span> <span class="phpOperator">)</span><span class="phpText">;</span> <span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span><span class="htmlOtherTag">&lt;/sy:updatePeriod&gt;</span>
		<span class="htmlOtherTag">&lt;sy:updateFrequency&gt;</span><span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span> <span class="phpFunction">echo</span><span class="htmlText"> apply_filters</span><span class="phpOperator">(</span> <span class="phpString">'rss_update_frequency'</span><span class="phpText">,</span> <span class="phpString">'<span class="phpNumber">1</span>'</span> <span class="phpOperator">)</span><span class="phpText">;</span> <span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span><span class="htmlOtherTag">&lt;/sy:updateFrequency&gt;</span>
		<span class="htmlOtherTag">&lt;item&gt;</span>
		<span class="htmlOtherTag">&lt;/item&gt;</span>
	<span class="htmlOtherTag">&lt;/channel&gt;</span>
<span class="htmlOtherTag">&lt;/rss&gt;</span>
</pre>
<p>Now, you could see the &lt;item&gt; and &lt;/item&gt; tags, that is where we are going to add our feed items. From this moment I assume that all our RSS data is located in an array like this one.</p>
<pre class="php">
<span class="phpIdentifier">$rssItems</span> <span class="phpOperator">=</span> <span class="phpFunction">array</span><span class="phpOperator">(</span>
	<span class="phpString">'item_1'</span><span class="phpOperator"><span class="phpOperator">=</span><span class="phpOperator">&gt;</span></span><span class="phpFunction">array</span><span class="phpOperator">(</span>
		<span class="phpString">'Title'</span><span class="phpText">,</span>
		<span class="phpString">'Link'</span><span class="phpText">,</span>
		<span class="phpString">'Author'</span><span class="phpText">,</span>
		<span class="phpString">'Date'</span><span class="phpText">,</span>
		<span class="phpString">'Description'</span><span class="phpText">,</span>
		<span class="phpString">'Content'</span>
		<span class="phpOperator">)</span><span class="phpText">,</span>
	<span class="phpString">'item_2'</span><span class="phpOperator"><span class="phpOperator">=</span><span class="phpOperator">&gt;</span></span><span class="phpFunction">array</span><span class="phpOperator">(</span>
		<span class="phpString">'Title'</span><span class="phpText">,</span>
		<span class="phpString">'Link'</span><span class="phpText">,</span>
		<span class="phpString">'Author'</span><span class="phpText">,</span>
		<span class="phpString">'Date'</span><span class="phpText">,</span>
		<span class="phpString">'Description'</span><span class="phpText">,</span>
		<span class="phpString">'Content'</span>
		<span class="phpOperator">)</span>
	<span class="phpOperator">)</span><span class="phpText">;</span>
</pre>
<p>And so on. For adding the items to our feed, we simply use a foreach loop.</p>
<pre class="php">
<span class="phpKeyword">
foreach </span><span class="phpOperator">(</span><span class="phpIdentifier">$rssItems</span><span class="phpKeyword"> as </span><span class="phpIdentifier">$item</span><span class="phpOperator">)</span> <span class="phpOperator">{</span>
	<span class="phpFunction">echo</span> <span class="phpString">'<span class="phpOperator">&lt;</span>item<span class="phpOperator">&gt;</span>'</span><span class="phpText">;</span>
	<span class="phpFunction">echo</span> <span class="phpString">'<span class="phpOperator">&lt;</span>title<span class="phpOperator">&gt;</span>'</span> <span class="phpOperator">.</span> <span class="phpIdentifier">$item</span><span class="phpOperator">[</span><span class="phpString">'Title'</span><span class="phpOperator">]</span> <span class="phpOperator">.</span> <span class="phpString">'<span class="phpOperator">&lt;</span>/title<span class="phpOperator">&gt;</span>'</span><span class="phpText">;</span>
	<span class="phpFunction">echo</span> <span class="phpString">'<span class="phpOperator">&lt;</span>link<span class="phpOperator">&gt;</span>'</span> <span class="phpOperator">.</span> <span class="phpIdentifier">$item</span><span class="phpOperator">[</span><span class="phpString">'Link'</span><span class="phpOperator">]</span> <span class="phpOperator">.</span> <span class="phpString">'<span class="phpOperator">&lt;</span>/link<span class="phpOperator">&gt;</span>'</span><span class="phpText">;</span>
	<span class="phpFunction">echo</span> <span class="phpString">'<span class="phpOperator">&lt;</span>dc<span class="phpOperator">:</span>creator<span class="phpOperator">&gt;</span>'</span> <span class="phpOperator">.</span> <span class="phpIdentifier">$item</span><span class="phpOperator">[</span><span class="phpString">'Author'</span><span class="phpOperator">]</span> <span class="phpOperator">.</span> <span class="phpString">'<span class="phpOperator">&lt;</span>/dc<span class="phpOperator">:</span>creator<span class="phpOperator">&gt;</span>'</span><span class="phpText">;</span>
	<span class="phpFunction">echo</span> <span class="phpString">'<span class="phpOperator">&lt;</span>pubDate<span class="phpOperator">&gt;</span>'</span> <span class="phpOperator">.</span> mysql2date<span class="phpOperator">(</span><span class="phpString">'D<span class="phpText">,</span> d M Y H<span class="phpOperator">:</span>i<span class="phpOperator">:</span>s <span class="phpOperator">+</span>0000'</span><span class="phpText">,</span> <span class="phpIdentifier">$item</span><span class="phpOperator">[</span><span class="phpString">'Date'</span><span class="phpOperator">]</span><span class="phpOperator">)</span> <span class="phpOperator">.</span> <span class="phpString">'<span class="phpOperator">&lt;</span>/pubDate<span class="phpOperator">&gt;</span>'</span><span class="phpText">;</span>
	<span class="phpFunction">echo</span> <span class="phpString">'<span class="phpOperator">&lt;</span>description<span class="phpOperator">&gt;</span>'</span> <span class="phpOperator">.</span> <span class="phpIdentifier">$item</span><span class="phpOperator">[</span><span class="phpString">'Description'</span><span class="phpOperator">]</span> <span class="phpOperator">.</span> <span class="phpString">'<span class="phpOperator">&lt;</span>/description<span class="phpOperator">&gt;</span>'</span><span class="phpText">;</span>
	<span class="phpFunction">echo</span> <span class="phpString">'<span class="phpOperator">&lt;</span>content<span class="phpOperator">:</span>encoded<span class="phpOperator">&gt;</span><span class="phpOperator">&lt;</span><span class="phpOperator">!</span><span class="phpOperator">[</span>CDATA<span class="phpOperator">[</span>'</span> <span class="phpOperator">.</span> <span class="phpIdentifier">$item</span><span class="phpOperator">[</span><span class="phpString">'Content'</span><span class="phpOperator">]</span> <span class="phpOperator">.</span> <span class="phpString">'<span class="phpOperator">]</span><span class="phpOperator">]</span><span class="phpOperator">&gt;</span><span class="phpOperator">&lt;</span>/content<span class="phpOperator">:</span>encoded<span class="phpOperator">&gt;</span>'</span><span class="phpText">;</span>
	<span class="phpFunction">echo</span> <span class="phpString">'<span class="phpOperator">&lt;</span>/item<span class="phpOperator">&gt;</span>'</span><span class="phpText">;</span>
<span class="phpOperator">}</span>
</pre>
<p>The mysql2date function is a WordPress function that converts our date to the format we want for our feed. The input should be the date in the following format: <code>d-m-Y H:i:s</code>. See <a href="http://php.net/date">php.net</a> for more information about the date formatting.</p>
<p>Now we have finished our function, we have only one thing to do.</p>
<h2>Adding the RSS Feed to WordPress</h2>
<p>To add the feed, we could use one simple function, build-in in WordPress since version <code>2.1.0</code>. This is the <code>add_feed</code> function. This function has two parameters.</p>
<ul>
<li>$feedname; The name of your feed.</li>
<li>$function; The function that creates the feed. (The one we created above)</li>
</ul>
<p>So lets say we name our feed: &#8216;guestbook&#8217;, then we should call the <code>add_feed</code> function this way:</p>
<pre class="php">
<span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span>
<span class="phpComment">// Add our<span class="phpKeyword"> new </span><span class="htmlText">RSS feed</span><span class="phpOperator">.</span>
</span><span class="htmlText">add_feed</span><span class="phpOperator">(</span><span class="phpString">'guestbook'</span><span class="phpText">,</span> <span class="phpString">'myGreatPluginRSSFeed'</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span>
</pre>
<p>Now our feed is added and working! One thing you might be asking yourself is: Where could I find my feed? Well, that&#8217;s simple.<br />
If you are using permalinks on your blog (could be checked this way: <code>$wp_rewrite->using_permalinks()</code>), then your feed is located at: http://your.website.com/[feedname].<br />
If you don&#8217;t use permalinks, your feed is located at: http://your.website.com/?feed=[feedname].</p>
<h2>Done!</h2>
<p>After all our hard work, we have created one beautiful RSS 2.0 feed, working with WordPress. Any questions? Please <a href="http://www.frank-verhoeven.com/create-an-rss-feed-with-wordpress/#respond">leave a comment</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.frank-verhoeven.com/create-an-rss-feed-with-wordpress/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Wordpress Plugin - FV Community News</title>
		<link>http://www.frank-verhoeven.com/wordpress-plugin-fv-community-news/</link>
		<comments>http://www.frank-verhoeven.com/wordpress-plugin-fv-community-news/#comments</comments>
		<pubDate>Tue, 30 Sep 2008 15:02:23 +0000</pubDate>
		<dc:creator>Frank Verhoeven</dc:creator>
		
		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://www.frank-verhoeven.com/?p=200</guid>
		<description><![CDATA[Many blogs out there can only produce a couple articles a week while their visitors ask for loads more. It&#8217;s sometimes a good idea to add related articles from other blogs to your sidebar. Adding them manually takes lots of time we don&#8217;t have.  With this new Community News plugin you allow your visitors [...]]]></description>
			<content:encoded><![CDATA[<p>Many blogs out there can only produce a couple articles a week while their visitors ask for loads more. It&#8217;s sometimes a good idea to add related articles from other blogs to your sidebar. Adding them manually takes lots of time we don&#8217;t have.  With this new <strong>Community News </strong>plugin you allow your visitors to add articles to the sidebar. Complete with moderation panel and a settings page, you can sit back while you have full control about the look and articles that being posted. <span id="more-200"></span></p>
<h2>Features</h2>
<p>Currently, the Community News plugin has the following features:</p>
<ul>
<li>Widget Ready (Different form/results widget)</li>
<li>Moderation panel (with email option) - Make sure you approve the right articles</li>
<li>Edit Submissions</li>
<li>`My Submissions` Page</li>
<li>Customizable templates</li>
<li>Captcha Spam protection (on/off)</li>
<li>Akismet Spam protection (API key required)</li>
<li>Build-in RSS 2.0 Feed</li>
<li>Image Uploading</li>
<li>Settings</li>
</ul>
<h2>How To Install &amp; Use</h2>
<ol>
<li><a href="/wordpress-plugin-fv-community-news/#download">Download the files</a></li>
<li>Upload the files to <em>/wp-content/plugins</em></li>
<li>Activate the plugin (<em>WP-admin &gt; Plugins &gt; FV Community News</em>)</li>
<li>Browse<strong> Community News &gt; Settings</strong> to select the settings you prefer.</li>
<li>Go to <strong>Design &gt; Widgets</strong> to add the Community News widgets to your sidebar.</li>
</ol>
<p>You can also show your Community News plugin on a static page. You can do that by placing the following codes on a page that does support <em>PHP</em>:</p>
<p><strong>Add Form</strong></p>
<pre class="php"><span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span><span class="phpKeyword"> if </span><span class="phpOperator">(</span><span class="phpFunction"><span class="phpFunctionKeyword">function</span>_exists</span><span class="phpOperator">(</span><span class="phpString">'fvCommunityNewsForm'</span><span class="phpOperator">)</span><span class="phpOperator">)</span>
<span class="htmlText">
    fvCommunityNewsForm</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpText">;</span> <span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span></pre>
<p><strong>Latest Submissions</strong></p>
<pre class="php">
<span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span><span class="phpKeyword"> if </span><span class="phpOperator">(</span><span class="phpFunction"><span class="phpFunctionKeyword">function</span>_exists</span><span class="phpOperator">(</span><span class="phpString">'fvCommunityNewsGetSubmissions'</span><span class="phpOperator">)</span><span class="phpOperator">)</span>
    <span class="phpFunction">echo</span><span class="htmlText"> fvCommunityNewsGetSubmissions</span><span class="phpOperator">(</span><span class="htmlText">Number</span><span class="phpText">,</span><span class="htmlText"> Template</span><span class="phpOperator">)</span><span class="phpText">;</span> <span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span>
</pre>
<ul>
<li>Number - Insert number of items you would like to show here</li>
<li>Template - Structure per item. You can use these tags:<br />
<em>
<ul>
<li>%submission_author%</li>
<li>%submission_author_email%</li>
<li>%submission_title%</li>
<li>%submission_url%</li>
<li>%submission_description%</li>
<li>%submission_date%</li>
<li>%submission_image%</li>
</ul>
<p></em>
</li>
</ul>
<p>By default the Template is: &#8216;<code>&lt;li&gt;&lt;h3&gt;&lt;a href="%submission_url%" title="%submission_title%"&gt;%submission_title%&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;%submission_description%&lt;/p&gt;&lt;small&gt;%submission_date%&lt;/small&gt;&lt;/li&gt;</code>&#8216;. &lt;ul&gt; &lt;/ul&gt; tags are automatically added.</p>
<h2>Example</h2>
<p>Take a look at the sidebar, you could see the plugin in action right there. Also my friend uses Community News on his blog, so you can see a working example on <a href="http://www.divitodesign.com/">DivitoDesign</a>.</p>
<p><a href="http://www.frank-verhoeven.com/wp-content/uploads/2008/09/fvcommunitynewssettings.png"><img class="size-medium wp-image-208" title="fvCommunityNewsSettings" src="http://www.frank-verhoeven.com/wp-content/uploads/2008/09/fvcommunitynewssettings-500x246.png" alt="fvCommunityNewsSettings" width="500" height="246" /></a></p>
<p><small>The FV Community News settings page.</small></p>
<h2>Bugs &amp; Questions</h2>
<p>If you find any bug in the latest version of this plugin, I hope you&#8217;d be so kind to tell me about it. This will only improve the plugin, which is better for the users!  When you have anything else to say (<em>appreciated!</em>), please <a href="/wordpress-plugin-fv-community-news#respond">comment</a>!</p>
<h2>Plugin Info</h2>
<p>AUTHOR: <strong>Frank Verhoeven</strong><br />
AUTHOR URL: <strong><a href="http://www.frank-verhoeven.com/">http://www.frank-verhoeven.com/</a></strong><br />
WORDPRESS VERSION: <strong>2.5+</strong><br />
TESTED UP TO: <strong>2.7</strong><br />
CURRENT VERSION: <strong>1.2.3</strong></p>
<h2>Change log</h2>
<p><a href="http://www.frank-verhoeven.com/fv-community-news-version-11/">Version 1.1</a><br />
<a href="http://www.frank-verhoeven.com/fv-community-news-v12/">Version 1.2</a></p>
<h2 id="download">Download</h2>
<p>DOWNLOAD: <a href="http://downloads.wordpress.org/plugin/fv-community-news.zip">FV Community News</a></p>
<h2>Donate</h2>
<p>Like this plugin? Please consider making a small donation.</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" class="donate-form">
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHLwYJKoZIhvcNAQcEoIIHIDCCBxwCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBjqmG9+oPl/DOSCGUJmFH5arVzlcIA41EnGFHbgzqkdftKN27PmOYE+TDvNQgb0MkjFzH6cP/wI62lzQnYn7DA6xolQM/tlJ+nqX0873P1RwGXXOXvu1oBs5SpDcs43K6vjEXhb7j3xswka68avggILL1ZTg57gIUiRorexsnYZzELMAkGBSsOAwIaBQAwgawGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIcW8PWGv+M3CAgYg+ZJLbRlIhtdWa1Q6T4WOyA84GSfFs0MIpstXB5iAns3UlLfWsnTKIWJXuftaFdgMjo6qF/FhNlrhiUpHPNEai94ADSVEStsmHZy5v4noKH/bJkDaMyfmTUxIZXyp2T02v2djDqR9jOIbQ4LVRb0Q/lK19UB45VhY7uBCIf+RZly8C/880HavLoIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMB4XDTA0MDIxMzEwMTMxNVoXDTM1MDIxMzEwMTMxNVowgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBR07d/ETMS1ycjtkpkvjXZe9k+6CieLuLsPumsJ7QC1odNz3sJiCbs2wC0nLE0uLGaEtXynIgRqIddYCHx88pb5HTXv4SZeuv0Rqq4+axW9PLAAATU8w04qqjaSXgbGLP3NmohqM6bV9kZZwZLR/klDaQGo1u9uDb9lr4Yn+rBQIDAQABo4HuMIHrMB0GA1UdDgQWBBSWn3y7xm8XvVk/UtcKG+wQ1mSUazCBuwYDVR0jBIGzMIGwgBSWn3y7xm8XvVk/UtcKG+wQ1mSUa6GBlKSBkTCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMDgxMDI0MTAxODEzWjAjBgkqhkiG9w0BCQQxFgQUq/5jgT5jcKwGkXA4+Idplpzj6vcwDQYJKoZIhvcNAQEBBQAEgYCoo/U8Bwn6nSb14xVbrOvg9BpYjJOoQZJSS0ITog3qoU76TdQ4ncEQ+Y2POdldtzZm2Mr4axeB7MWFnrq5MEnOULdmiEgVoY707FcPh06yfK1YU+Swng88Sb9dcREyUS/YmUJbqpUrfPEH5e9xEL0zjT8mlFQ33ipeDEHwPtOJ3g==-----END PKCS7-----" />
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="" />
</form>
<p>Or help promoting it by adding a link to this page, definitely appreciated <img src='http://www.frank-verhoeven.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.frank-verhoeven.com/wordpress-plugin-fv-community-news/feed/</wfw:commentRss>
		</item>
		<item>
		<title>FV Code Highlighter V1.1</title>
		<link>http://www.frank-verhoeven.com/fv-code-highlighter-v11/</link>
		<comments>http://www.frank-verhoeven.com/fv-code-highlighter-v11/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 17:36:00 +0000</pubDate>
		<dc:creator>Frank Verhoeven</dc:creator>
		
		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://www.frank-verhoeven.com/?p=180</guid>
		<description><![CDATA[The moment is here, the release of the FV Code Highlighter plugin version 1.1. In this release PHP is completely supported. I told you that I would try to implement JavaScript and Java as well, but unfortunately this isn&#8217;t done yet. The reason for this is that I simply already wanted to release this version [...]]]></description>
			<content:encoded><![CDATA[<p>The moment is here, the release of the <strong>FV Code Highlighter</strong> plugin version 1.1. In this release PHP is completely supported. I told you that I would try to implement JavaScript and Java as well, but unfortunately this isn&#8217;t done yet. The reason for this is that I simply already wanted to release this version because of the (better) support for PHP.</p>
<p>Also the admin panel is improved for better usability, see the screenshot below.</p>
<p><a href="http://www.frank-verhoeven.com/wp-content/uploads/2008/09/admin.png"><img src="http://www.frank-verhoeven.com/wp-content/uploads/2008/09/admin-300x147.png" alt="FV Code Highlighter - Admin Interface" title="FV Code Highlighter - Admin Interface" width="300" height="147" class="size-medium wp-image-182" /></a><br /><small>FV Code Highlighter - New Admin Interface</small></p>
<p>Furthermore, a security issue, which makes it possible for every subscriber of your blog to change the code display settings, is solved. And a few little bugs have been fixed.</p>
<p>For details on how to use this plugin, please visit <a href="http://www.frank-verhoeven.com/wordpress-plugin-fv-code-highlighter/">original</a> post.</p>
<p>Download here: <a href="http://downloads.wordpress.org/plugin/fv-code-highlighter.zip">FV Code Highlighter</a>, <a href="http://www.frank-verhoeven.com/download.php?f=ZnYtY29kZS1oaWdobGlnaHRlci56aXA=">Mirror</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.frank-verhoeven.com/fv-code-highlighter-v11/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using Sessions in WordPress</title>
		<link>http://www.frank-verhoeven.com/using-session-in-wordpress/</link>
		<comments>http://www.frank-verhoeven.com/using-session-in-wordpress/#comments</comments>
		<pubDate>Sat, 20 Sep 2008 12:03:54 +0000</pubDate>
		<dc:creator>Frank Verhoeven</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.frank-verhoeven.com/?p=158</guid>
		<description><![CDATA[Yesterday, when I was creating a new plugin for my friend Stefan Vervoort, I needed sessions to work. Unfortunately, WordPress doesn&#8217;t support them!??
I searched the whole source code of this great piece of blogging software, and not on one single line I found even one session. Also the session_start() function is not called, but I [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, when I was creating a new plugin for my friend <a href="http://www.divitodesign.com/">Stefan Vervoort</a>, I needed sessions to work. Unfortunately, WordPress doesn&#8217;t support them!??</p>
<p>I searched the whole source code of this great piece of blogging software, and not on one single line I found even one session. Also the <a href="http://www.php.net/session_start">session_start()</a> function is not called, but I still needed my sessions to work <img src='http://www.frank-verhoeven.com/wp-includes/images/smilies/icon_confused.gif' alt=':-?' class='wp-smiley' /> .</p>
<p>So I started searching Google for a fix of my problem. I found a lot of people asking the same question: &#8220;Why don&#8217;t sessions work in WordPress?&#8221; Finally I found a solution to fix this little issue and guess what, it is a simple one.<br />
<span id="more-158"></span></p>
<h2>The Solution</h2>
<p>The only thing you have to do is call session_start(); before any output is send to the client. Now you might think: Nice, but what happens when I upgrade my WordPress installation to the latest version? Well, yes, your changes will be lost. That is the reason why we first should think of where to add these changes..</p>
<p>Normally upgrading your installation will replace all files, except one. Yes, it is the wp-config.php file. And even better, there isn&#8217;t send any output to a client yet, when this file is loaded.</p>
<p>So, we add the next lines of code to our wp-config.php file:</p>
<pre class="php">
<span class="phpComment">// Make the<span class="phpKeyword"> use </span>of sessions possible.
</span>>if <span class="phpOperator">(</span><span class="phpOperator">!</span><span class="phpFunction">session_id</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpOperator">)</span>
<span class="phpFunction">session_start</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpText">;</span>
</pre>
<p>And sessions are enabled on your blog!<br />
I think the best place to add these lines is at the top of the config file, so immediately after the php starting tag (&lt;?php).</p>
<p>I hope this will help you out when facing the same problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.frank-verhoeven.com/using-session-in-wordpress/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New PHP Highlighter In Town</title>
		<link>http://www.frank-verhoeven.com/new-php-highlighter-in-town/</link>
		<comments>http://www.frank-verhoeven.com/new-php-highlighter-in-town/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 09:31:57 +0000</pubDate>
		<dc:creator>Frank Verhoeven</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://www.frank-verhoeven.com/?p=138</guid>
		<description><![CDATA[Hey everyone,
As you could have read here, the current release of my code highlighter has some trouble with highlighting PHP on servers running PHP version 4. I told you I should try to fix the problem and include a better PHP highlighter in the next release.
I worked very hard this morning to get PHP fixed, [...]]]></description>
			<content:encoded><![CDATA[<p>Hey everyone,</p>
<p>As you could have read <a href="http://www.frank-verhoeven.com/wordpress-plugin-fv-code-highlighter/#comment-11">here</a>, the current release of my code highlighter has some trouble with highlighting PHP on servers running PHP version 4. I told you I should try to fix the problem and include a better PHP highlighter in the next release.</p>
<p>I worked very hard this morning to get PHP fixed, and I&#8217;m proud to announce that PHP is almost working the way it should. That means: including servers running PHP4.</p>
<p>You want an example? Sure, here it is:</p>
<h2>PHP Code Like It Should</h2>
<pre class="php">
<span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span>
<span class="phpFunction">mysql_connect</span> <span class="phpOperator">(</span><span class="phpIdentifier">$host</span><span class="phpText">,</span> <span class="phpIdentifier">$user</span><span class="phpText">,</span> <span class="phpIdentifier">$password</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpIdentifier">$result</span> <span class="phpOperator">=</span> <span class="phpFunction">mysql_db_query</span> <span class="phpOperator">(</span><span class="phpString">'Database'</span><span class="phpText">,</span> <span class="phpString">'select * from table'</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpKeyword">
while </span><span class="phpOperator">(</span><span class="phpIdentifier">$row</span> <span class="phpOperator">=</span> <span class="phpFunction">mysql_fetch_assoc</span> <span class="phpOperator">(</span><span class="phpIdentifier">$result</span><span class="phpOperator">)</span><span class="phpOperator">)</span>
<span class="phpOperator">{</span>
	<span class="phpFunction">echo</span> <span class="phpIdentifier">$row</span><span class="phpOperator">[</span><span class="phpString">'user_id'</span><span class="phpOperator">]</span><span class="phpText">;</span>
	<span class="phpFunction">echo</span> <span class="phpIdentifier">$row</span><span class="phpOperator">[</span><span class="phpString">'fullname'</span><span class="phpOperator">]</span><span class="phpText">;</span>
<span class="phpOperator">}</span>
<span class="phpFunction">mysql_free_result</span> <span class="phpOperator">(</span><span class="phpIdentifier">$result</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span>
</pre>
<h2>So, What&#8217;s Next?</h2>
<p>After this highlighter is finished, I create one for JavaScript and properly one for Java. As soon as they all work the way it should, I will release version 1.1.</p>
<p>See you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.frank-verhoeven.com/new-php-highlighter-in-town/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Short If-Else Structure</title>
		<link>http://www.frank-verhoeven.com/short-if-else-structure/</link>
		<comments>http://www.frank-verhoeven.com/short-if-else-structure/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 17:33:54 +0000</pubDate>
		<dc:creator>Frank Verhoeven</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.frank-verhoeven.com/?p=121</guid>
		<description><![CDATA[In addition to the enlarged if - else statement that you will use in most cases, there is also a short structure for an if - else statement. This format uses the so-called &#8220;ternary operator &#8216;. The syntax of this shorthand structure is as follows:

$var = [condition] ? [true] : [false];


Condition = The condition which [...]]]></description>
			<content:encoded><![CDATA[<p>In addition to the enlarged if - else statement that you will use in most cases, there is also a short structure for an if - else statement. This format uses the so-called &#8220;ternary operator &#8216;. The syntax of this shorthand structure is as follows:</p>
<pre class="php">
<span class="phpIdentifier">$var</span> <span class="phpOperator">=</span> <span class="phpOperator">[</span>condition<span class="phpOperator">]</span> <span class="phpOperator">?</span> <span class="phpKeyword"><span class="phpOperator">[</span>true<span class="phpOperator">]</span></span> <span class="phpOperator">:</span> <span class="phpKeyword"><span class="phpOperator">[</span>false<span class="phpOperator">]</span></span><span class="phpText">;</span>
</pre>
<ol>
<li>Condition = The condition which must be met.</li>
<li>True = Executed if the condition is met.</li>
<li>False = Executed if the condition failes.</li>
</ol>
<p><span id="more-121"></span><br />
Thus, the above statement means the same as this enlarged structure:</p>
<pre class="php">
<span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span>
<span class="phpKeyword">
if </span><span class="phpOperator">(</span><span class="htmlText">condition</span><span class="phpOperator">)</span> <span class="phpOperator">{</span>
    <span class="phpIdentifier">$var</span> <span class="phpOperator">=</span> <span class="phpKeyword"><span class="phpOperator">[</span><span class="htmlText">true</span><span class="phpOperator">]</span></span><span class="phpText">;</span>
<span class="phpOperator">}</span><span class="phpKeyword"> else </span><span class="phpOperator">{</span>
    <span class="phpIdentifier">$var</span> <span class="phpOperator">=</span> <span class="phpKeyword"><span class="phpOperator">[</span><span class="htmlText">false</span><span class="phpOperator">]</span></span><span class="phpText">;</span>
<span class="phpOperator">}</span>
<span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span>
</pre>
<h2>Examples</h2>
<p>Let&#8217;s take a look at some example.</p>
<p>Filled in a name?</p>
<pre class="php">
<span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span>
<span class="phpIdentifier">$name</span> <span class="phpOperator">=</span> <span class="phpFunction">isset</span><span class="phpOperator">(</span><span class="phpScriptVar"><span class="phpIdentifier">$_POST</span></span><span class="phpOperator">[</span><span class="phpString">'name'</span><span class="phpOperator">]</span><span class="phpOperator">)</span><span class="phpOperator">?</span><span class="phpScriptVar"><span class="phpIdentifier">$_POST</span></span><span class="phpOperator">[</span><span class="phpString">'name'</span><span class="phpOperator">]</span><span class="phpOperator">:</span><span class="phpString">'Unknown'</span><span class="phpText">;</span>
<span class="phpComment">// If <span class="phpScriptVar"><span class="phpIdentifier">$_POST</span></span><span class="phpOperator">[</span><span class="phpString">'name'</span><span class="phpOperator">]</span><span class="htmlText"> exists</span><span class="phpText">,</span><span class="htmlText"> we</span><span class="phpKeyword"> use </span><span class="htmlText">that</span><span class="phpKeyword"> for </span><span class="htmlText">the name</span><span class="phpText">,</span><span class="phpKeyword"> else </span><span class="htmlText">we</span><span class="phpKeyword"> use </span><span class="htmlText">Unknown</span><span class="phpOperator">.</span>
</span><span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span>
</pre>
<p>We can also use it to easily echo stuff:</p>
<pre class="php">
<span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span>
<span class="phpIdentifier">$fruit</span> <span class="phpOperator">=</span> <span class="phpString">'apple'</span><span class="phpText">;</span>
<span class="phpFunction">echo</span> <span class="phpOperator">(</span><span class="phpString">'pear'</span> <span class="phpOperator"><span class="phpOperator">=</span>=</span> <span class="phpIdentifier">$fruit</span><span class="phpOperator">)</span><span class="phpOperator">?</span><span class="phpString">'pear'</span><span class="phpOperator">:</span><span class="phpString">'apple'</span><span class="phpText">;</span>
<span class="phpComment">// Will <span class="phpFunction">echo</span> apple
</span><span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span>
</pre>
<p>It is even possible to use php-functions inside it:</p>
<pre class="php">
<span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span>
<span class="phpIdentifier">$input</span> <span class="phpOperator">=</span> <span class="phpString">'Just a string to be hashed'</span><span class="phpText">;</span>
<span class="phpIdentifier">$hashMethod</span> <span class="phpOperator">=</span> <span class="phpString">'<span class="phpFunction">sha1</span>'</span><span class="phpText">;</span>
<span class="phpIdentifier">$hash</span> <span class="phpOperator">=</span> <span class="phpOperator">(</span><span class="phpString">'<span class="phpFunction">sha1</span>'</span> <span class="phpOperator"><span class="phpOperator">=</span>=</span> <span class="phpIdentifier">$hashMethod</span><span class="phpOperator">)</span><span class="phpOperator">?</span><span class="phpFunction">sha1</span><span class="phpOperator">(</span><span class="phpIdentifier">$input</span><span class="phpOperator">)</span><span class="phpOperator">:</span><span class="phpFunction">md5</span><span class="phpOperator">(</span><span class="phpIdentifier">$input</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpComment">// <span class="phpIdentifier">$hash</span><span class="htmlText"> will contain an </span><span class="phpFunction">sha1</span><span class="htmlText"> hash of </span><span class="phpIdentifier">$input</span>
</span><span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span>
</pre>
<h2>Conclusion</h2>
<p>The short if-else structure is a good way to keep your code organized. However, it is not possible to use such a thing as: &#8216;elseif&#8217;.<br />
I use it all the time to assign values to variables, with just one rule of code, I&#8217;m sure my vars have a proper value. Especially when using forms, this is a very useful function of PHP.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.frank-verhoeven.com/short-if-else-structure/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Wordpress Plugin - FV Code Highlighter</title>
		<link>http://www.frank-verhoeven.com/wordpress-plugin-fv-code-highlighter/</link>
		<comments>http://www.frank-verhoeven.com/wordpress-plugin-fv-code-highlighter/#comments</comments>
		<pubDate>Wed, 10 Sep 2008 17:05:32 +0000</pubDate>
		<dc:creator>Frank Verhoeven</dc:creator>
		
		<category><![CDATA[Wordpress Plugins]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.frank-verhoeven.com/?p=26</guid>
		<description><![CDATA[The main subject of this blog will be web development and feature some interesting articles and tutorials ranging from PHP and jQuery to HTML and CSS. The problem I was facing when I built this theme was the lack of awesome code highlight plugin. I just couldn&#8217;t find one that was working for me.

FV Code [...]]]></description>
			<content:encoded><![CDATA[<p>The main subject of this blog will be web development and feature some interesting articles and tutorials ranging from PHP and jQuery to HTML and CSS. The problem I was facing when I built this theme was the lack of <strong>awesome</strong> code highlight plugin. I just couldn&#8217;t find one that was working for me.</p>
<p><a href="#download"><img title="FV Code Highlighter Example" src="http://www.frank-verhoeven.com/wp-content/uploads/2008/09/fv-code-highlighter-1.jpg" alt="FV Code Highlighter Example" /></a><br />
<small><em>FV Code Highlight Example</em></small></p>
<p>I thought maybe more people were looking for a plugin that simply publish codes that looks great. I started to write my own, and the <strong>FV Code Highlight plugin</strong> was born and now open for the public. The features are plain and simple, read on.<br />
<span id="more-26"></span></p>
<h2>Description</h2>
<p>This plugin supports the highlighting of PHP, HTML, CSS and XML. The default tag-highlighter color scheme uses the same colors Adobe&#8217;s Dreamweaver is using. This makes it easy for your visitors to recognize what type of codes you wrote. These colors can be changed to your liking in the WPadmin section of your blog.</p>
<h2>Features</h2>
<ul>
<li>Easy to use</li>
<li>Renders XHTML, CSS, XML and PHP (in parts)</li>
<li>Default look: Dreamweaver style</li>
<li>Customizable look of codes and code box</li>
</ul>
<h2>How to use this plugin?</h2>
<p>1. Upload the folder `fv-code-highlighter` to the `/wp-content/plugins/` directory<br />
2. Activate the plugin through the &#8216;Plugins&#8217; menu in WordPress<br />
3. Place <img class="alignnone size-full wp-image-95" title="fv-code-highlighter-21" src="http://www.frank-verhoeven.com/wp-content/uploads/2008/09/fv-code-highlighter-21.jpg" alt="" width="244" height="21" /> in your pages to use the highlighter</p>
<h2 id="example">Example</h2>
<h3>CSS Code</h3>
<pre class="css"><span class="cssComment">/* Comment */</span>
<span class="cssImport">@import url(<span class="cssString">"main.css"</span>);</span>
<span class="cssSelector">h2, .head2 {</span>
    <span class="cssProperty">font-family</span><span class="cssRest">:</span><span class="cssValue"> <span class="cssString">"Sans-Serif"</span></span><span class="cssRest">;</span>
    <span class="cssProperty">font-weight</span><span class="cssRest">:</span><span class="cssValue"> bold</span><span class="cssRest">;</span>
    <span class="cssProperty">color</span><span class="cssRest">:</span><span class="cssValue"> #336699 <span class="cssImportant">!important</span></span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
<span class="cssMedia">@media screen, print {</span>
    <span class="cssSelector">pre {</span> <span class="cssProperty">margin</span><span class="cssRest">:</span><span class="cssValue"> 0px 10px 10px</span><span class="cssRest">;</span> <span class="cssSelector">}</span>
    <span class="cssSelector">h1 {</span> <span class="cssProperty">font-size</span><span class="cssRest">:</span><span class="cssValue"> 14px</span><span class="cssRest">;</span> <span class="cssProperty">padding-top</span><span class="cssRest">:</span><span class="cssValue"> 10px</span><span class="cssRest">;</span> <span class="cssSelector">}</span>
<span class="cssMedia">}</span>
</pre>
<h3>(x)HTML Code</h3>
<pre class="html">
<span class="htmlStyleTag">&lt;style type=<span class="cssString">&quot;text/css&quot;</span>&gt;</span>  <span class="cssSelector">headline {</span><span class="cssProperty">font-size</span><span class="cssRest">:</span><span class="cssValue"> 24pt</span><span class="cssRest">;</span><span class="cssSelector">}</span>  <span class="htmlStyleTag">&lt;/style&gt;</span>
<span class="htmlComment"><span class="htmlOtherTag">&lt;!-- Comment --&gt;</span></span>
<span class="htmlTableTag">&lt;td&gt;</span><span class="htmlAnchorTag">&lt;a href=<span class="htmlAttributeValue">&quot;link&quot;</span>&gt;</span>Plain Text <span class="htmlSpecialChar">&amp;nbsp;</span><span class="htmlAnchorTag">&lt;/a&gt;</span>
<span class="htmlImageTag">&lt;img src=<span class="htmlAttributeValue">&quot;image&quot;</span> alt=<span class="htmlAttributeValue">&quot;&quot;</span> width=<span class="htmlAttributeValue">&quot;15&quot;</span> /&gt;</span>
<span class="htmlFormTag">&lt;form action=<span class="htmlAttributeValue">&quot;action.pl&quot;</span>&gt;</span> <span class="htmlFormTag">&lt;input type=<span class="htmlAttributeValue">&quot;submit&quot;</span> value=<span class="htmlAttributeValue">&quot;Press Me&quot;</span> /&gt;</span>
<span class="htmlFormTag">&lt;/form&gt;</span>Text<span class="htmlTableTag">&lt;/td&gt;</span>
</pre>
<h2>Plugin Info</h2>
<p>AUTHOR: <strong>Frank Verhoeven</strong><br />
AUTHOR URL: <strong><a href="http://www.frank-verhoeven.com/">http://www.frank-verhoeven.com/</a></strong><br />
WORDPRESS VERSION: <strong>2.5+</strong><br />
TESTED UP TO: <strong>2.6.2</strong><br />
CURRENT VERSION: <strong>1.0</strong></p>
<h2 id="download">Download</h2>
<p>DEMO: <a href="#example">Live Demo</a><br />
DOWNLOAD: <a href="http://downloads.wordpress.org/plugin/fv-code-highlighter.zip">FV Code Highlighter</a>, <a href="http://www.frank-verhoeven.com/download.php?f=ZnYtY29kZS1oaWdobGlnaHRlci56aXA=">Mirror</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.frank-verhoeven.com/wordpress-plugin-fv-code-highlighter/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Code Highlighter Preview</title>
		<link>http://www.frank-verhoeven.com/code-highlighter-preview/</link>
		<comments>http://www.frank-verhoeven.com/code-highlighter-preview/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 22:45:40 +0000</pubDate>
		<dc:creator>Frank Verhoeven</dc:creator>
		
		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://www.frank-verhoeven.com/blog/?p=10</guid>
		<description><![CDATA[Below is an example of my Code Higlighter that I will release whithin this week.
A reallife example can be found at DivitoDesign.com.
CSS Code
/* Comment */
@import url("main.css");
h2, .head2 {
    font-family: "Sans-Serif";
    font-weight: bold;
    color: #336699 !important;
}
@media screen, print {
    pre { margin: 0px 10px [...]]]></description>
			<content:encoded><![CDATA[<p>Below is an example of my Code Higlighter that I will release whithin this week.<br />
A reallife example can be found at <a href="http://www.divitodesign.com/">DivitoDesign.com</a>.</p>
<h3>CSS Code</h3>
<pre class="css"><span class="cssComment">/* Comment */</span>
<span class="cssImport">@import url(<span class="cssString">"main.css"</span>);</span>
<span class="cssSelector">h2, .head2 {</span>
    <span class="cssProperty">font-family</span><span class="cssRest">:</span><span class="cssValue"> <span class="cssString">"Sans-Serif"</span></span><span class="cssRest">;</span>
    <span class="cssProperty">font-weight</span><span class="cssRest">:</span><span class="cssValue"> bold</span><span class="cssRest">;</span>
    <span class="cssProperty">color</span><span class="cssRest">:</span><span class="cssValue"> #336699 <span class="cssImportant">!important</span></span><span class="cssRest">;</span>
<span class="cssSelector">}</span>
<span class="cssMedia">@media screen, print {</span>
    <span class="cssSelector">pre {</span> <span class="cssProperty">margin</span><span class="cssRest">:</span><span class="cssValue"> 0px 10px 10px</span><span class="cssRest">;</span> <span class="cssSelector">}</span>
    <span class="cssSelector">h1 {</span> <span class="cssProperty">font-size</span><span class="cssRest">:</span><span class="cssValue"> 14px</span><span class="cssRest">;</span> <span class="cssProperty">padding-top</span><span class="cssRest">:</span><span class="cssValue"> 10px</span><span class="cssRest">;</span> <span class="cssSelector">}</span>
<span class="cssMedia">}</span>
</pre>
<p><span id="more-10"></span></p>
<h3>(x)HTML Code</h3>
<pre class="html">
<span class="htmlStyleTag">&lt;style&gt;</span> <span class="cssSelector">headline {</span><span class="cssProperty">font-size</span><span class="cssRest">:</span><span class="cssValue"> 24pt</span><span class="cssRest">;</span><span class="cssSelector">}</span> <span class="htmlStyleTag">&lt;/style&gt;</span>
<span class="htmlComment"><span class="htmlOtherTag">&lt;!-- Comment --&gt;</span></span>
<span class="htmlTableTag">&lt;td&gt;</span><span class="htmlOtherTag">&lt;p&gt;</span><span class="htmlAnchorTag">&lt;a href=<span class="htmlAttributeValue">&quot;link&quot;</span>&gt;</span>Plain Text  <span class="htmlAnchorTag">&lt;/a&gt;</span>
<span class="htmlImageTag">&lt;img src=<span class="htmlAttributeValue">&quot;image&quot;</span> width=<span class="htmlAttributeValue">&quot;15&quot;</span> /&gt;</span>
<span class="htmlOtherTag">&lt;/p&gt;</span><span class="htmlFormTag">&lt;form action=<span class="htmlAttributeValue">&quot;action.pl&quot;</span>&gt;</span>
<span class="htmlFormTag">&lt;input type=<span class="htmlAttributeValue">&quot;submit&quot;</span> value=<span class="htmlAttributeValue">&quot;Press Me&quot;</span> /&gt;</span>
<span class="htmlFormTag">&lt;/form&gt;</span>Text<span class="htmlTableTag">&lt;/td&gt;</span>
</pre>
<h3>XML Code</h3>
<pre class="xml">
<span class="xmlTag">&lt;scheme name=<span class="xmlString">&quot;XML&quot;</span> doctypes=<span class="xmlString">&quot;XML&quot;</span> priority=<span class="xmlString">&quot;50&quot;</span>&gt;</span>
<span class="xmlTag">&lt;ignoreCase&gt;</span><span class="xmlText">Yes</span><span class="xmlTag">&lt;/ignoreCase&gt;</span>
<span class="xmlTag">&lt;defaultText MMString:name=<span class="xmlString">&quot;Text/scheme/name&quot;</span> /&gt;</span>
<span class="xmlTag">&lt;defaultAttribute name=<span class="xmlString">&quot;Attribute&quot;</span> /&gt;</span>
<span class="xmlTag">&lt;/scheme&gt;</span>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.frank-verhoeven.com/code-highlighter-preview/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
