<?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>Parampal.com &#187; cforms</title>
	<atom:link href="http://parampal.com/tag/cforms/feed/" rel="self" type="application/rss+xml" />
	<link>http://parampal.com</link>
	<description>Parampal Pooni, Freelance Web applications Developer and Web hosting provider</description>
	<lastBuildDate>Thu, 14 Jan 2010 01:06:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Using WordPress as a CMS</title>
		<link>http://parampal.com/using-wordpress-as-a-cms/</link>
		<comments>http://parampal.com/using-wordpress-as-a-cms/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 22:25:41 +0000</pubDate>
		<dc:creator>Parampal</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[PHP Programming]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[cforms]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[cms made simple]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[register plus]]></category>
		<category><![CDATA[understanding wordpress database]]></category>
		<category><![CDATA[wordpress database]]></category>
		<category><![CDATA[wp_posts]]></category>
		<category><![CDATA[wp_terms]]></category>
		<category><![CDATA[wp_term_relationships]]></category>
		<category><![CDATA[wp_term_taxonomy]]></category>

		<guid isPermaLink="false">http://parampal.com/?p=42</guid>
		<description><![CDATA[Recently I chose to use the popular PHP blogging software WordPress as a fully blown CMS for a recruiting website that I needed to develop. Coming from a Joomla, CMS Made Simple background I found wordpress completely satisfied my needs as a CMS developer. It showed to have: A customisable User login / registration (using [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I chose to use the popular PHP blogging software <a href="http://wordpress.org">WordPress</a> as a fully blown CMS for a recruiting website that I needed to develop. Coming from a <a href="http://www.joomla.org">Joomla</a>, <a href="http://www.cmsmadesimple.org">CMS Made Simple</a> background I found wordpress completely satisfied my needs as a CMS developer. It showed to have:</p>
<ol>
<li>A customisable User login / registration (using the <a href="http://wordpress.org/extend/plugins/register-plus">Register Plus</a> plugin)</li>
<li>Customisable forms which allow you to process form data and error handling during all stages of a form submission. (using the <a href="http://www.deliciousdays.com/cforms-plugin">cforms</a> plugin)</li>
<li>Accessing and understanding the database was relatively easy</li>
<li>I could easily locate a large number of free themes to pick from, which look professional and elegant (see themes websites: <a href="http://topwpthemes.com/">http://topwpthemes.com</a> and <a href="http://wordpress.org/extend/themes/">http://wordpress.org/extend/themes</a>)</li>
</ol>
<p>One obvious fact I noticed straight away was that wordpress relies on plugins to do anything beyond the basic blogging task. Fortunately there are already existing plugins for most advanced features that you might require &#8211; below I talk a bit about the above points in more details.</p>
<h3>1. Register Plus</h3>
<p> <a href="http://wordpress.org/extend/plugins/register-plus">http://wordpress.org/extend/plugins/register-plus</a></p>
<p>I used this plugin to extend my user registration form, to contain beyond the basic fields such as name and email. The installation and configuration is all done in the admin area under the Users tab and is all self explainatory. See screen shot below for what the admin area looks like</p>
<div id="attachment_46" class="wp-caption alignleft" style="width: 310px"><a href="http://parampal.com/wp-content/uploads/2009/03/registerplus.jpg"><img class="size-medium wp-image-46" title="Register Plus Admin Console Screenshot" src="http://parampal.com/wp-content/uploads/2009/03/registerplus-300x257.jpg" alt="Register Plus Admin Console Screenshot" width="300" height="257" /></a><p class="wp-caption-text">Register Plus Admin Console Screenshot</p></div>
<h3>2. cForms</h3>
<p> <a href="http://www.deliciousdays.com/cforms-plugin">http://www.deliciousdays.com/cforms-plugin</a></p>
<p>Allows you to create customised forms, with fields of all types. It gives you the option of using ajax in your forms for submission and error checking and is very easy to install and configure.</p>
<p>To handle data submitted by forms you simply place your code within the wp-content/plugins/cforms/my-functions.php file. In this file you will find numerous functions commented out, each function serves its own purpose and allows you to retrieve the form data during different stages of the form submission process. For example, if you need to do something after validation, but before processing has been completed by cforms you will put your code in the my_cforms_filter() function (or the my_cforms_ajax_filter() function if you chose to use ajax). If you need to run code after all the processing by cforms is complete you should place your code in the my_cforms_action() function. See below for an example my_cforms_action() function</p>
<p><code><br />
function my_cforms_action($cformsdata) {</p>
<p>$formID = $cformsdata['id'];           /* This is the form id used when you create your form - this is so you can perform processing for a specific form */<br />
$form   = $cformsdata['data'];         /* This contains all the form data posted */</p>
<p>//job application form<br />
if ( $formID == '2' ) {</p>
<p>$application_data = array (</p>
<p>'email' =&amp;gt; $form['Email'],<br />
'first_name' =&amp;gt; $form['First Name'],<br />
'last_name' =&amp;gt; $form['Last Name'],<br />
'date_applied' =&amp;gt; $date_applied,<br />
'note_id' =&amp;gt; $note_id,<br />
'note_file_extension' =&amp;gt; findexts($form['Resume[*2]']),<br />
'comment' =&amp;gt; $form['Comment'],<br />
'file' =&amp;gt; $form['Resume[*2]']<br />
);</p>
<p>.....</p>
<p>}<br />
</code></p>
<h3>3. Understanding the wordpress database</h3>
<p>Understanding the wordpress database structure was not a difficult task. When manipulating the database there are only really 4 tables you need to concern yourself with:</p>
<ul>
<li><strong>wp_terms:</strong> Creates a generic term</li>
<li><strong>wp_term_taxonomy:</strong> Allows you to label a term as something more significant, such as a category</li>
<li><strong>wp_posts:</strong> Stores all posts, pages and revisions</li>
<li><strong>wp_term_relationships:</strong> Stores all the labels for a given post. For instance this would store every category a single post has been placed under. This therefore needs to store a reference to the wp_posts and wp_term_taxonomy tables</li>
</ul>
<h3>4. WordPress Themes</h3>
<p>WordPress themes are similar to plugins, they basically control the way your page looks. You can freely find themes on the web, here are a bunch of my favourite theme sites:</p>
<ul>
<li> <a href="http://topwpthemes.com/">http://topwpthemes.com</a></li>
<li><a href="http://wordpress.org/extend/themes/">http://wordpress.org/extend/themes</a></li>
<li><a href="http://wordpressthemesbase.com/">http://wordpressthemesbase.com</a></li>
<li><a href="http://www.templatesbrowser.com/wordpress-themes/">http://www.templatesbrowser.com/wordpress-themes</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://parampal.com/using-wordpress-as-a-cms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

