<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Matt Varone» Matt Varone » Creative Developer</title>
	
	<link>http://www.mattvarone.com</link>
	<description>Creative Developer</description>
	<lastBuildDate>Mon, 13 Jul 2009 14:40:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<image>
<link>http://www.mattvarone.com</link>
<url>http://www.mattvarone.com/wp-content/mbp-favicon/favicon.ico</url>
<title>Matt Varone</title>
</image>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/feed/mattvarone" type="application/rss+xml" /><item>
		<title>SimpleForm: Easy PHP multi-form email handler</title>
		<link>http://www.mattvarone.com/web-design/simpleform-php-email-script/</link>
		<comments>http://www.mattvarone.com/web-design/simpleform-php-email-script/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 18:49:46 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[FORMS]]></category>
		<category><![CDATA[MAIL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.mattvarone.com/?p=705</guid>
		<description><![CDATA[— It&#8217;s been a while, but today I am releasing a new version of my contact form script, this time under the name SimpleForm. It&#8217;s a nicer version of the previous one, re-written from the ground up and with a couple of new features. SimpleForm is basically meant to be an easy solution to handle [...]<p>This is a post from: <a href="http://www.mattvarone.com">Matt Varone</a></p>
]]></description>
			<content:encoded><![CDATA[<p>— It&#8217;s been a while, but today I am releasing a new version of my <a href="http://www.mattvarone.com/web-design/php-contact-form-script/" title="contact form script" >contact form script</a>, this time under the name <strong>SimpleForm</strong>. It&#8217;s a nicer version of the previous one, re-written from the ground up and with a couple of new features. SimpleForm is basically meant to be an <strong>easy solution to handle one or many forms with little effort</strong>. It&#8217;s mainly focused on ease of use and rapid deployment.</p>
<p><img src="http://www.mattvarone.com/wp-content/uploads/2009/04/simpleform.jpg" alt="simpleform" title="simpleform" width="577" height="134" class="aligncenter border" /></p>
<p class="message-box info"> Current version: <strong>1.1.3</strong> <small>7/13/09</small>  </p>
<h4>These are a couple of it&#8217;s main features <strong>( ver. 1.1.3 )</strong>:</h4>
<p>* Multiform handler.<br />
* Support for required fields.<br />
* PHP <a href="http://www.linuxjournal.com/article/9585" title="email validation" >email validation</a>.<br />
* Unobtrusive JavaScript function to pre-check form data ( 4KB file ).<br />
* Lightweight, easy to use.<br />
* Multilingual support.<br />
* External configuration file that can reside outside the public folder.</p>
<div class="post-box"><small>→ SimpleForm: <a href="http://lab.mattvarone.com/demos/simpleform/">View the demo</a> | <a href="http://lab.mattvarone.com/demos/simpleform/multiple.php" title="Mutiple Forms">Mutiple Forms</a> | <a href="http://lab.mattvarone.com/demos/simpleform/simpleform.1.1.3.zip">↓ Download</a> </small></div>
<h3>HOW DOES IT WORKS?</h3>
<p>It&#8217;s very simple, first there is a configuration file where you define all of your website forms, by this I mean form title, form fields, form required fields and the location of each form. Then there are some snippets you have to add to your form page/s and thats all. SimpleForm takes care of pre-cheking the form fields with JS and then validating them with PHP, if it&#8217;s valid then it will send the email to the configured email address and return the user to the form page with a success message or otherwise, with an error message.</p>
<h3>INSTALLING THE SCRIPT</h3>
<h4>These are the necessary steps to have it up and running ( requires PHP 5 ):</h4>
<ol  class="normal">
<li><strong>Download</strong> <a href="http://lab.mattvarone.com/demos/simpleform/simpleform.1.1.3.zip">SimpleForm</a> ( ver 1.1.3 )</li>
<li><strong>Open sf-config.php</strong> and edit the necessary info.</li>
<li><strong>Upload sf-config.php</strong> to your host ( preferably outside the public folder ).</li>
<li>Open <strong>simpleform.php</strong> and edit the variable <em>$PATH_TO_CONFIG_FILE</em> ( on line 24 ) with the path from <em>simpleform.php</em> to <em>sf-config.php</em> ( leave empty if it resides on the same folder ).</li>
<li>Upload<strong> simpleform.php</strong>, <strong>simpleform.css</strong> and <strong>checkform.mini.js</strong> inside your public folder.</li>
<li>Open your form page/s and <strong>add the necessary code snippets</strong>.</li>
</ol>
<p><span id="more-705"></span></p>
<h3>EDITING THE CONFIGURATION FILE SF-CONFIG.PHP</h3>
<pre class="brush: php">
# ------------------------------------------------------------ #
// SIMPLEFORM CONFIGURATION								      //
# ------------------------------------------------------------ #

/* GENERAL CONFIGURATION
/////////////////////////////*/

// The name of the website/client. Example: &quot;My Website&quot;.
$aSettings[&quot;szFrom&quot;] = &quot;&quot;;							

// The email address that will receive the emails. Example: &quot;me@myemail.com&quot;.
$aSettings[&quot;szRecipient&quot;] = &quot;&quot;;		

/* The email address that will be used to send the emails. To work properly this has to be a real account
configured on the same server of the site. Example: &quot;noreply@mywebsite.com&quot;. */
$aSettings[&quot;szFromEmail&quot;] = &quot;&quot;;					    

/* FORMS CONFIGURATION
/////////////////////////////*/

/* The next step is to configure the Form/s.
   You can add as many as you want. */

$aForms = array(

	1 =&gt; array( 									// FORM ID: 1
		&quot;szFormTitle&quot; =&gt; &quot;&quot;,						// FORM TITLE - Example: &quot;Contact Form&quot;
		&quot;szFormURL&quot; =&gt; &quot;&quot;,							// FORM URL ( users will be redirected to this page )
		&quot;szFormRequired&quot; =&gt; array(					/* REQUIRED FIELDS ( array of name attributes ) */
			&quot;name&quot;,
			&quot;email&quot;,
		),
		&quot;aFormFields&quot; =&gt; array( 					/* LIST OF FORM FIELDS AND THEIR OUTPUT NAME
 													  All input fields coming from the form should go here.
													  The first value is the name attribute used and the second value
													  on the right the name displayed on the outputed data.

													  Any required field that contains the word &quot;email&quot; will have
													  it&quot;s value validated as an email address. */
		   	&quot;name&quot; =&gt; &quot;First Name&quot;,
			&quot;email&quot; =&gt; &quot;E-mail&quot;,
			&quot;work_email&quot; =&gt; &quot;Work Email&quot;,
			&quot;phone&quot; =&gt; &quot;Telephone&quot;,
			&quot;-sep1&quot; =&gt; &quot;This is a separator&quot;,		/* This is a separator. Any variable starting with the sign &quot;-&quot;
														will act as a content separator. */
			&quot;color&quot; =&gt; &quot;Color Option&quot;,
			&quot;comments&quot; =&gt; &quot;Comments&quot;,
			&quot;-sep2&quot; =&gt; &quot;This is Another separator&quot;,
			&quot;newsletter&quot; =&gt; &quot;Subscribe to our Newsletter?&quot;,
			&quot;interested[]&quot; =&gt; &quot;Im interested in&quot;,
			/* add more */
			)
	),

	2 =&gt; array(										/* Form 2. Same as above */
		&quot;szFormTitle&quot; =&gt; &quot;&quot;,
		&quot;szFormRequired&quot; =&gt; array(),
		&quot;szFormURL&quot; =&gt; &quot;&quot;,
		&quot;aFormFields&quot; =&gt; array(
			/* add more */
			)
	),

	3 =&gt; array(										/* Form 3. Same as above */
		&quot;szFormTitle&quot; =&gt; &quot;&quot;,
		&quot;szFormRequired&quot; =&gt; array(),
		&quot;szFormURL&quot; =&gt; &quot;&quot;,
		&quot;aFormFields&quot; =&gt; array(
			/* add more */
			)
		),

	/* add more */
);

/* RESPONSE CONFIGURATION
/////////////////////////////*/

/* Response Messages: These are the variables that hold the messages
the system prints as response. You can modify them to suit your project needs. */

 // Form has been sent.
$aSettings[&quot;aMessages&quot;][&quot;szSubmitSucess&quot;]  = &quot;Your message has been sent succesfully. Thanks!&quot;;
// Missing fields.
$aSettings[&quot;aMessages&quot;][&quot;szMissingFields&quot;] = &quot;Please complete all required fields.&quot;;
// Unvalid email address.
$aSettings[&quot;aMessages&quot;][&quot;szUnvalidEmail&quot;]  = &quot;Please insert a valid email address.&quot;;
// Email not sent by system error.
$aSettings[&quot;aMessages&quot;][&quot;szSystemError&quot;]   = &quot;There was an error in the system. Please try again later. Thanks!&quot;;

/* ADVANCED CONFIGURATION
/////////////////////////////*/

// Name of the GET variable to pass response messages
define( &quot;GET_NAME&quot;, &quot;response&quot;);
// Debug mode ( prints email content, and system errors )
define( &quot;DEBUG_MODE&quot; , false );
/* Check if the domain of the submited email addresses exists.
False by default as it may bring problems with some servers. ) */
define( &quot;CHECK_EMAIL_ADDRESS_DNS&quot; , false );
</pre>
<h3>INTEGRATING SIMPLEFORM WITH YOUR FORMS</h3>
<p>Below you&#8217;ll find the things you need to do to your form page ( must be php file ) for SimpleForm to work. I also have included a full example at bottom.</p>
<h4>A. Add  Javascript and CSS files</h4>
<p>	Add <strong>simpleform.css</strong> and<strong> checkform.js</strong> ( or <strong>checkform.mini.js</strong> ) inside the <strong>&lt;head&gt;</strong> element:</p>
<pre class="brush: html">
	&lt;link rel=&quot;stylesheet&quot; href=&quot;simpleform.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot;/&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;checkform.mini.js&quot;&gt;&lt;/script&gt;
	</pre>
<h4>B. Define the path to the config file and Include <strong>simpleform.php</strong> in the document ( before your form/s ):</h4>
<pre class="brush: php">
	&lt;?php
	define( &quot;CONFIG_PATH&quot;, &quot;place/here/the/path/to/sf-congif/dir/&quot; );
	require_once &quot;simpleform.php&quot;;
	$sForm = new simpleForm();
	?&gt;
	</pre>
<h4>C. Add SimpleForm <strong>Responses function</strong></h4>
<p>		   Prints the systems response and can reside anywhere on the document.</p>
<pre class="brush: php">
			&lt;?php
 		   	// Example: &lt;p class=&quot;message-box error&quot;&gt;Please insert a valid email address.&lt;/p&gt;
 		   	$sForm-&gt;handleMessage(); ?
 		   	&gt;
		</pre>
<p>Output example:
<p class="message-box error">Please insert a valid email address.</p>
<h4>D. Add SimpleForm <strong>Form function</strong></h4>
<p> This function generates the required hidden input fields for simpleForm to work. The value passed is the ID assigned to the current form in the configuration file. This function must reside in between the &lt;form&gt;&lt;/form&gt;  elements.</p>
<pre class="brush: php">
 &lt;?php
 //Prints necessary data for the form with the ID = 1
$sForm-&gt;printData(1);
?&gt;
</pre>
<h4>E. Edit the<strong> &lt;form&gt; attributes</strong>:</h4>
<p>	Point the form&#8217;s <em>action attribute</em> to <strong>simpleform.php</strong> and then add the <strong>checkform</strong> function to enable the js data pre-checking.</p>
<pre class="brush: html">

	&lt;form action=&quot;simpleform.php&quot; method=&quot;post&quot; onsubmit=&quot;return checkform(this)&quot;&gt;
</pre>
<p>	The <strong>checkform()</strong> function supports an optional string parameter which alters the text you<br />
want to display on the js alerts. The variable #name is provided as a wildcard for the field Name.</p>
<p>	<strong>Examples:</strong><br />
				&#8220;Please complete the field #name&#8221;<br />
				&#8220;The field #name is missing&#8221;<br />
				&#8220;Por Favor complete el campo #name&#8221;</p>
<pre class="brush: html">
				onsubmit=&quot;return checkform(this,&#039;The field #name is missing&#039;)&quot;
				</pre>
<h4>Full Example</h4>
<pre class="brush: php">
	&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
		&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
		&lt;head&gt;
			&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
			&lt;title&gt;SimpleForm Example&lt;/title&gt;
			&lt;link rel=&quot;stylesheet&quot; href=&quot;simpleform.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot;/&gt;
			&lt;script type=&quot;text/javascript&quot; src=&quot;checkform.mini.js&quot;&gt;&lt;/script&gt;
		&lt;/head&gt;
		&lt;body&gt;

			&lt;?php
			define( &quot;CONFIG_PATH&quot;, &quot;../secure/&quot; );

			require_once &quot;simpleform.php&quot;;
			$sForm = new simpleForm();

			$sForm-&gt;handleMessage();
			?&gt;

			&lt;form action=&quot;simpleform.php&quot; method=&quot;post&quot; onsubmit=&quot;return checkform(this)&quot;&gt;
		 	&lt;fieldset&gt;
		 	&lt;?php $sForm-&gt;printData(1); ?&gt;
				&lt;legend&gt;Personal Details:&lt;/legend&gt;
		        &lt;label for=&quot;name&quot; &gt;Name&lt;/label&gt;
		        &lt;input name=&quot;name&quot; id=&quot;name&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;
		        &lt;label for=&quot;email&quot;&gt;Email &lt;span class=&quot;required&quot;&gt;(required)&lt;/span&gt;&lt;/label&gt;
		        &lt;input name=&quot;email&quot; id=&quot;email&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;
				&lt;label for=&quot;work_email&quot;&gt;Work Email&lt;/label&gt;
		        &lt;input name=&quot;work_email&quot; id=&quot;work_email&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;
				&lt;label for=&quot;phone&quot;&gt;Telephone &lt;span class=&quot;required&quot;&gt;(required)&lt;/span&gt;&lt;/label&gt;
		        &lt;input name=&quot;phone&quot; id=&quot;phone&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;
		        &lt;label for=&quot;color&quot;&gt;Color Options: &lt;span class=&quot;required&quot;&gt;(required)&lt;/span&gt;&lt;/label&gt;
		        &lt;select name=&quot;color&quot; id=&quot;color&quot;&gt;
					&lt;option value=&quot;-&quot;&gt;Choose a color&lt;/option&gt;
					&lt;option value=&quot;Red&quot;&gt;Red&lt;/option&gt;
					&lt;option value=&quot;Green&quot;&gt;Green&lt;/option&gt;
					&lt;option value=&quot;Blue&quot;&gt;Blue&lt;/option&gt;
				&lt;/select&gt;
		        &lt;label for=&quot;comments&quot;&gt;Comments&lt;/label&gt;
		        &lt;textarea name=&quot;comments&quot; id=&quot;comments&quot; rows=&quot;10&quot; cols=&quot;50&quot;&gt;&lt;/textarea&gt;
		        &lt;/fieldset&gt;
		        &lt;fieldset class=&quot;radio&quot;&gt;
		            &lt;legend&gt;Subscribe to our Newsletter? &lt;span class=&quot;required&quot;&gt;(required)&lt;/span&gt;&lt;/legend&gt;
		            &lt;label&gt;&lt;input type=&quot;radio&quot; name=&quot;newsletter&quot; value=&quot;Yes&quot; /&gt; Yes&lt;/label&gt;
		            &lt;label&gt;&lt;input type=&quot;radio&quot; name=&quot;newsletter&quot; value=&quot;No&quot; /&gt; No&lt;/label&gt;
		        &lt;/fieldset&gt;
				&lt;fieldset class=&quot;checkbox&quot;&gt;
		            &lt;legend&gt;Im interested in: &lt;span class=&quot;required&quot;&gt;(required)&lt;/span&gt;&lt;/legend&gt;
		            &lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;interested[]&quot; value=&quot;Arts&quot; /&gt; Arts&lt;/label&gt;
					&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;interested[]&quot; value=&quot;Science&quot; /&gt; Science&lt;/label&gt;
					&lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;interested[]&quot; value=&quot;Sports&quot; /&gt; Sports&lt;/label&gt;
		        &lt;/fieldset&gt;

		        &lt;p&gt;&lt;button type=&quot;submit&quot;&gt;Submit this!&lt;/button&gt;&lt;/p&gt;
		    &lt;/form&gt;

		&lt;/body&gt;
		&lt;/html&gt;
</pre>
<div class="post-box"><small>→ SimpleForm: <a href="http://lab.mattvarone.com/demos/simpleform/">View the demo</a> | <a href="http://lab.mattvarone.com/demos/simpleform/multiple.php" title="Mutiple Forms">Mutiple Forms</a> | <a href="http://lab.mattvarone.com/demos/simpleform/simpleform.1.1.2.zip">↓ Download</a> </small></div>
<h3>RELEASE NOTES</h3>
<p><strong>ver 1.1.3</strong> &#8211; Email Bug fixed ( Mayor thanks to Jim from <a href="http://www.cpscreative.com">cpscreative.com</a> )<br />
<strong>ver 1.1.2</strong> &#8211; Minor Bugs fixed.<br />
<strong>ver 1.1.1</strong> &#8211; Optional Email DNS checking.<br />
<strong>ver 1.1</strong> &#8211; Easier path deployment, Configurable response variable name, Debug function and minor bug fixes<br />
<strong>ver 1.0</strong> &#8211; First Release.</p>
<p>This is a post from: <a href="http://www.mattvarone.com">Matt Varone</a></p>

	<h4 class="related">Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.mattvarone.com/web-design/php-contact-form-script/" title="PHP Contact form script (September 16, 2008)">PHP Contact form script</a> (4)</li>
	<li><a href="http://www.mattvarone.com/web-design/ternary-conditionals-in-php/" title="Ternary Conditionals in PHP (October 25, 2008)">Ternary Conditionals in PHP</a> (5)</li>
	<li><a href="http://www.mattvarone.com/wordpress/scrnshotsrss-plugin-update-2/" title="ScrnshotsRSS plugin 2.0 update (November 10, 2008)">ScrnshotsRSS plugin 2.0 update</a> (2)</li>
	<li><a href="http://www.mattvarone.com/wordpress/images-post-wordpress-regular-expressions/" title="Manipulate images from WordPress post&#8217;s content with Regular Expressions (October 7, 2008)">Manipulate images from WordPress post&#8217;s content with Regular Expressions</a> (22)</li>
	<li><a href="http://www.mattvarone.com/wordpress/list-recent-posts-in-wordpress/" title="List recent posts in WordPress (September 15, 2008)">List recent posts in WordPress</a> (3)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.mattvarone.com/web-design/simpleform-php-email-script/feed/</wfw:commentRss>
		<slash:comments>41</slash:comments>
		</item>
		<item>
		<title>Custom WordPress function to check page parent</title>
		<link>http://www.mattvarone.com/wordpress/wordpress-check-page-parent/</link>
		<comments>http://www.mattvarone.com/wordpress/wordpress-check-page-parent/#comments</comments>
		<pubDate>Sun, 12 Apr 2009 21:39:14 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[TEMPLATE FUNCTIONS]]></category>

		<guid isPermaLink="false">http://www.mattvarone.com/?p=694</guid>
		<description><![CDATA[&#8212; Quick update to the is_subpage() function. Basically it&#8217;s does the same but now it also accepts an integer to check if the current page is a child of certain ID. This way its easier to track if  the current location is a subpage of a certain page. If it matches it will return [...]<p>This is a post from: <a href="http://www.mattvarone.com">Matt Varone</a></p>
]]></description>
			<content:encoded><![CDATA[<p>&mdash; Quick update to the <a href="http://www.mattvarone.com/wordpress/is_subpage-function/">is_subpage() function</a>. Basically it&#8217;s does the same but now it also accepts an integer to check if the current page is a child of certain ID. This way its easier to track if  the current location is a subpage of a certain page. If it matches it will return a <strong>true</strong> value otherwise, it will be <strong>false</strong>.</p>
<div class="post-box"><small>→  Download <a href="http://lab.mattvarone.com/demos/wp-functions/functions-part4.zip">the function here</a></small></div>
<pre class="brush: php">
function is_subpage( $iID = null )
	{
		global $post, $wpdb;

		if ( is_page() AND isset( $post-&gt;post_parent ) != 0 )
		{
			$aParent = $wpdb-&gt;get_row( $wpdb-&gt;prepare( &quot;SELECT ID FROM $wpdb-&gt;posts WHERE ID = %d AND post_type = &#039;page&#039; LIMIT 1&quot;, $post-&gt;post_parent ) );

			if ( is_int( $iID ) &gt; 0 )
				if ( $aParent-&gt;ID == $iID ) return true; else return false;
			else
				if ( $aParent-&gt;ID )	return true; else return false;

		}
		else
		{
			return false;
		}
	}

/* EXAMPLE */

if ( is_page(&#039;producs&#039;) OR is_subpage( 8 ) )
{
  //do something
};
</pre>
<p>Cheers!</p>
<p>This is a post from: <a href="http://www.mattvarone.com">Matt Varone</a></p>

	<h4 class="related">Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.mattvarone.com/wordpress/list-recent-posts-in-wordpress/" title="List recent posts in WordPress (September 15, 2008)">List recent posts in WordPress</a> (3)</li>
	<li><a href="http://www.mattvarone.com/wordpress/list-users/" title="Custom Query: List WordPress Users (November 19, 2008)">Custom Query: List WordPress Users</a> (50)</li>
	<li><a href="http://www.mattvarone.com/wordpress/add-css-javascript-wordpress-theme/" title="Correct way of adding CSS and Javascript references to WordPress themes (October 5, 2008)">Correct way of adding CSS and Javascript references to WordPress themes</a> (10)</li>
	<li><a href="http://www.mattvarone.com/wordpress/useful-functions-for-wordpress/" title="Useful custom functions for WordPress (November 11, 2008)">Useful custom functions for WordPress</a> (55)</li>
	<li><a href="http://www.mattvarone.com/web-design/ternary-conditionals-in-php/" title="Ternary Conditionals in PHP (October 25, 2008)">Ternary Conditionals in PHP</a> (5)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.mattvarone.com/wordpress/wordpress-check-page-parent/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Clean Accessible Form Foundation</title>
		<link>http://www.mattvarone.com/web-design/clean-accesible-form-foundation/</link>
		<comments>http://www.mattvarone.com/web-design/clean-accesible-form-foundation/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 20:15:35 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[FORMS]]></category>
		<category><![CDATA[HTML and XHTML]]></category>

		<guid isPermaLink="false">http://www.mattvarone.com/?p=215</guid>
		<description><![CDATA[— As soon as you drop tables you find that making nicely formated and accessible forms is not that simple. There are many discussed methods to achieve this and there will always be something to argue about them. Having said that I present you here with a solution that  in most of the cases [...]<p>This is a post from: <a href="http://www.mattvarone.com">Matt Varone</a></p>
]]></description>
			<content:encoded><![CDATA[<p>— As soon as you drop tables you find that making nicely formated and accessible forms is not that simple. There are many discussed methods to achieve this and there will always be something to argue about them. Having said that I present you here with a solution that  in most of the cases works for me. I hope you find this useful.</p>
<div class="post-box"><small>→ Final product: <a href="http://lab.mattvarone.com/demos/clean-accessible-form/index.html">view the demo</a> | <a href="http://lab.mattvarone.com/demos/clean-accessible-form/demo-clean-form-mattvarone.com.zip">↓ Download</a> </small></div>
<h3>GOALS:</h3>
<p>There were a couple of things I had in mind when creating this form, first of all the code would have to be <strong>valid XHTML</strong>, clean semantic and well formated. This would need to have a good balance between <strong>accessibility and flexibility</strong> to make it <strong>portable</strong> and easy to style. This way you have more chances to easily copy and modify to adjust to different needs.<br />
<span id="more-215"></span></p>
<h3>The Markup:</h3>
<p>Beyond the input elements XHTML gives us a set of tags to build our forms in an accessible way. I like to use <em>Fieldsets</em>, <em>Legends</em> and <em>Labels</em>. To display nicely aligned radio and checkbox buttons I use classes in the fieldsets: <em>.checkbox</em> and <em>.radio</em>. To style the overall form correctly I use the class <em>.cleanform</em>.</p>
<pre class="brush: xhtml">
&lt;form class=&quot;cleanform&quot; action=&quot;#&quot;&gt;
	&lt;fieldset&gt;
        &lt;legend&gt;Personal Details:&lt;/legend&gt;
        &lt;label for=&quot;name&quot; &gt;Name &lt;span class=&quot;required&quot;&gt;(required)&lt;/span&gt;&lt;/label&gt;
        &lt;input name=&quot;name&quot; id=&quot;name&quot; type=&quot;text&quot; value=&quot;Example text.&quot; /&gt;
        &lt;label for=&quot;email&quot;&gt;Email &lt;span class=&quot;required&quot;&gt;(required)&lt;/span&gt;&lt;/label&gt;
        &lt;input name=&quot;email&quot; id=&quot;email&quot; type=&quot;text&quot; value=&quot;Example text.&quot; /&gt;
        &lt;label for=&quot;inquiry&quot;&gt;Inquiry&lt;/label&gt;
        &lt;select name=&quot;inquiry&quot; id=&quot;inquiry&quot;&gt;
            &lt;option value=&quot;comment&quot;&gt;Comment&lt;/option&gt;
            &lt;option value=&quot;suggestion&quot;&gt;Suggestion&lt;/option&gt;
            &lt;option value=&quot;feedback&quot;&gt;Feedback&lt;/option&gt;
        &lt;/select&gt;
        &lt;label for=&quot;comments&quot;&gt;Comments&lt;/label&gt;
        &lt;textarea name=&quot;comments&quot; id=&quot;comments&quot; rows=&quot;10&quot; cols=&quot;50&quot;&gt;Example text.&lt;/textarea&gt;
    &lt;/fieldset&gt;
    &lt;fieldset class=&quot;radio&quot;&gt;
        &lt;legend&gt;Subscribe to my Newsletter? &lt;span class=&quot;required&quot;&gt;(required)&lt;/span&gt;&lt;/legend&gt;
        &lt;label&gt;&lt;input type=&quot;radio&quot; name=&quot;newsletter&quot; value=&quot;Yes&quot; /&gt; Yes&lt;/label&gt;
        &lt;label&gt;&lt;input type=&quot;radio&quot; name=&quot;newsletter&quot; value=&quot;No&quot; /&gt; No&lt;/label&gt;
    &lt;/fieldset&gt;
	&lt;fieldset class=&quot;checkbox&quot;&gt;
        &lt;legend&gt;Aditional information&lt;/legend&gt;
        &lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;foo&quot; value=&quot;Foo yes&quot; /&gt; Foo&lt;/label&gt;
        &lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;bar&quot; value=&quot;Bar yes&quot; /&gt; Bar&lt;/label&gt;
    &lt;/fieldset&gt;
    &lt;p&gt;&lt;button type=&quot;submit&quot;&gt;Submit Form&lt;/button&gt;&lt;/p&gt;
&lt;/form&gt;
</pre>
<p>As you may see its a very simple and clean markup, I group related form elements in fieldsets and make use of the legend and label elements. </p>
<p>I also have the required labels. A common practice for this is to add an asterisk in red, I am not against that but I prefer to use the word &#8220;required&#8221; when possible. To achieve this I use the <em>span</em> element with a class named <em>.required</em>.</p>
<p>Optionally I add a little intro to make the form more intuitive:</p>
<pre class="brush: xhtml">
&lt;div class=&quot;formInfo&quot;&gt;
    &lt;h2&gt;Contact me Form&lt;/h2&gt;
    &lt;p&gt;Please complete the following form to reach me. Thank you!&lt;/p&gt;
&lt;/div&gt;
</pre>
<h3>The CSS</h3>
<p>CSS code for the <em>cleanform</em> class and its elements:</p>
<pre class="brush: css">
/* CLEAN FORM
/////////////////////////////*/

/* General */

.cleanform {
	font-size:1em;
	width:40em;
	color:#1b1b1b;
	text-align:left;
	margin:1em auto
}

/* Elements */

.cleanform  label,.cleanform legend{
	padding:0;
	margin:0.3em 0
}

.cleanform fieldset{
	padding:0.7em;
	border:1px solid #ddd;
	margin:0 0 0.5em 0
}

.cleanform label {
    font-weight:bold
}

.cleanform fieldset input {
    width:70%;
    line-height:1.5em;
	padding:0.15em
}

.cleanform .radio input,
.cleanform .checkbox input {
    width:auto;
    border:none;
    margin:0 1.5em 0 0
 }

.cleanform input, .cleanform textarea, .cleanform select {
    display:block;
    margin-bottom:1em;
    font-size:1em;
    border:1px solid #bbb;
    padding:0.15em;
    margin-right:1em
 }

.cleanform .radio label, .cleanform .radio input,
.cleanform .checkbox label, .cleanform .checkbox input {
    display:inline;
    margin:0 1.5em 0 0
}

.cleanform .radio input, .cleanform .checkbox input {
    margin:0 0.3em 0 0
}

/* Button */

.cleanform button {
	margin:0.3em 0;
	border:1px solid #ccc;
	background-color:#eee;
	font-size:1em;
	cursor:pointer;
	padding:0.5em
}

.cleanform button:hover {
	background-color:#e6efc2;
	border:1px solid #c6d880;
	color:#529214
}

.cleanform button:active {
	background-color:#333;
	color:white;
	border:1px solid #000
}

/* information */

.cleanform .formInfo {
    margin-bottom:1em;
    padding-bottom:0.5em;
    border-bottom:0.1em solid #ddd
}

.cleanform .formInfo h2 {
	color:#00889e;
	font-weight:bold;
	font-size:1.2em;
	margin-bottom:1em
}

.cleanform .formInfo p{
	text-align:justify
}

.cleanform .required {
	color:#ff3838;
	font-weight:bold;
	font-size:0.8em
}
</pre>
<p>With the styles above you have a clean, accessible and valid foundation from where you can style the form accordingly to your project needs. </p>
<div class="post-box"><small>→ Final product: <a href="http://lab.mattvarone.com/demos/clean-accessible-form/index.html">view the demo</a> | <a href="http://lab.mattvarone.com/demos/clean-accessible-form/demo-clean-form-mattvarone.com.zip">↓ Download</a> </small></div>
<h3>Conclusion</h3>
<p>I hope you found it useful and of course I suggest you to always choose the method/solution that you feel most comfortable with. Critics and comments are welcomed,<br />
Cheers!</p>
<p><small><em>This method has been tested in: IE6, IE7, Firefox 3 ( Mac &amp; PC ), Google Chrome, Opera ( Win )  and Safari 3.1 ( Mac ).</em></small></p>
<p>This is a post from: <a href="http://www.mattvarone.com">Matt Varone</a></p>

	<h4 class="related">Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.mattvarone.com/web-design/css-navigation-generator/" title="From the lab: CSS Navigation Bar Code Generator (December 16, 2008)">From the lab: CSS Navigation Bar Code Generator</a> (9)</li>
	<li><a href="http://www.mattvarone.com/web-design/daily-calendar-dates-with-css/" title="Daily Calendar Dates With CSS (September 23, 2008)">Daily Calendar Dates With CSS</a> (6)</li>
	<li><a href="http://www.mattvarone.com/web-design/css-text-based-navigation-bar-with-images/" title="CSS Text based navigation bar with images (June 27, 2008)">CSS Text based navigation bar with images</a> (30)</li>
	<li><a href="http://www.mattvarone.com/web-design/simpleform-php-email-script/" title="SimpleForm: Easy PHP multi-form email handler (April 16, 2009)">SimpleForm: Easy PHP multi-form email handler</a> (41)</li>
	<li><a href="http://www.mattvarone.com/web-design/php-contact-form-script/" title="PHP Contact form script (September 16, 2008)">PHP Contact form script</a> (4)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.mattvarone.com/web-design/clean-accesible-form-foundation/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>From the lab: CSS Navigation Bar Code Generator</title>
		<link>http://www.mattvarone.com/web-design/css-navigation-generator/</link>
		<comments>http://www.mattvarone.com/web-design/css-navigation-generator/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 18:18:23 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML and XHTML]]></category>
		<category><![CDATA[LAYOUT]]></category>
		<category><![CDATA[NAVIGATION BARS]]></category>

		<guid isPermaLink="false">http://www.mattvarone.com/?p=636</guid>
		<description><![CDATA[
— This web tool will help you generate the code you need to build a navigation bar with the technique described in this article: CSS Text based navigation bar with images.
The result is a valid and accessible text based imaged navigation bar with one sprite image, XHTML and CSS. I have included a short video [...]<p>This is a post from: <a href="http://www.mattvarone.com">Matt Varone</a></p>
]]></description>
			<content:encoded><![CDATA[<p><a title="CSS Navigation Bar Code Generator" href="http://lab.mattvarone.com/navbar/"><img class="border2 aligncenter size-full" title="CSS Navigation Bar Code Generator" src="http://www.mattvarone.com/wp-content/uploads/2008/12/cssnavbar.jpg" alt="CSS Navigation Bar Code Generator" width="610" height="320" /></a></p>
<p>— This web tool will help you generate the code you need to build a navigation bar with the technique described in this article: <a href="http://www.mattvarone.com/web-design/css-text-based-navigation-bar-with-images/">CSS Text based navigation bar with images</a>.</p>
<p>The result is a valid and accessible text based imaged navigation bar with one sprite image, XHTML and CSS. I have included a <a href="http://lab.mattvarone.com/navbar/video.html">short video</a> as well to showcase the process.</p>
<div class="post-box"><small>→ <a href="http://lab.mattvarone.com/navbar/">CSS Navigation Bar Code Generator</a></small></div>
<p>Please let me know if you have any comment. You can download the generated code in a zip file.</p>
<p>Hope you find it useful. Enjoy!</p>
<p>This is a post from: <a href="http://www.mattvarone.com">Matt Varone</a></p>

	<h4 class="related">Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.mattvarone.com/web-design/css-text-based-navigation-bar-with-images/" title="CSS Text based navigation bar with images (June 27, 2008)">CSS Text based navigation bar with images</a> (30)</li>
	<li><a href="http://www.mattvarone.com/web-design/daily-calendar-dates-with-css/" title="Daily Calendar Dates With CSS (September 23, 2008)">Daily Calendar Dates With CSS</a> (6)</li>
	<li><a href="http://www.mattvarone.com/web-design/clean-accesible-form-foundation/" title="Clean Accessible Form Foundation (January 8, 2009)">Clean Accessible Form Foundation</a> (32)</li>
	<li><a href="http://www.mattvarone.com/web-design/message-box-with-css/" title="Message Boxes with CSS (July 25, 2008)">Message Boxes with CSS</a> (10)</li>
	<li><a href="http://www.mattvarone.com/web-design/css-reusable-classes/" title="CSS Reusable Classes (July 1, 2008)">CSS Reusable Classes</a> (7)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.mattvarone.com/web-design/css-navigation-generator/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>is_subpage() – Custom Conditional Function</title>
		<link>http://www.mattvarone.com/wordpress/is_subpage-function/</link>
		<comments>http://www.mattvarone.com/wordpress/is_subpage-function/#comments</comments>
		<pubDate>Sat, 29 Nov 2008 17:06:24 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[RESOURCES]]></category>
		<category><![CDATA[TEMPLATES]]></category>

		<guid isPermaLink="false">http://www.mattvarone.com/?p=621</guid>
		<description><![CDATA[&#8212;  Quick conditional function for WordPress to check if the current page is a sub page. It works both inside and outside the main loop, only for 2.5 and upwards.
→  Download the function here
Example
Same way as you use is_page, is_home, etc.

&#60;?php if (have_posts()) : ?&#62;

	&#60;?php while (have_posts()) : the_post(); ?&#62;

		&#60;?php if ( is_subpage() [...]<p>This is a post from: <a href="http://www.mattvarone.com">Matt Varone</a></p>
]]></description>
			<content:encoded><![CDATA[<p>&mdash;  Quick conditional <a href="http://www.mattvarone.com/wordpress/functionsphp-wordpress-themes/">function for WordPress</a> to check if the current page is a sub page. It works both inside and outside the main loop, only for 2.5 and upwards.</p>
<div class="post-box"><small>→  Download <a href="http://lab.mattvarone.com/demos/wp-functions/functions-part3.zip">the function here</a></small></div>
<h3>Example</h3>
<p>Same way as you use is_page, is_home, etc.</p>
<pre class="brush: php">
&lt;?php if (have_posts()) : ?&gt;

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

		&lt;?php if ( is_subpage() ): ?&gt;
			&lt;p&gt; This is a subpage &lt;/p&gt;
		&lt;?php endif ?&gt;

	&lt;?php endwhile; ?&gt;
</pre>
<p><span id="more-621"></span></p>
<h3>The Function</h3>
<pre class="brush: php">

function is_subpage()
{
	global $post, $wpdb;

	if ( is_page() AND isset( $post-&gt;post_parent ) != 0 )
	{
		$aParent = $wpdb-&gt;get_row( $wpdb-&gt;prepare( &quot;SELECT ID FROM $wpdb-&gt;posts WHERE ID = %d AND post_type = &#039;page&#039; LIMIT 1&quot;, $post-&gt;post_parent ) );
		if ( $aParent-&gt;ID ) return true; else return false;
	}
	else
	{
		return false;
	}
}
</pre>
<p>Im not sure why WordPress didn&#8217;t include a function like this by default, i hope you find it useful.<br />
Cheers!</p>
<p>This is a post from: <a href="http://www.mattvarone.com">Matt Varone</a></p>

	<h4 class="related">Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.mattvarone.com/wordpress/scrnshotsrss-plugin-update-2/" title="ScrnshotsRSS plugin 2.0 update (November 10, 2008)">ScrnshotsRSS plugin 2.0 update</a> (2)</li>
	<li><a href="http://www.mattvarone.com/web-design/php-contact-form-script/" title="PHP Contact form script (September 16, 2008)">PHP Contact form script</a> (4)</li>
	<li><a href="http://www.mattvarone.com/wordpress/list-recent-posts-in-wordpress/" title="List recent posts in WordPress (September 15, 2008)">List recent posts in WordPress</a> (3)</li>
	<li><a href="http://www.mattvarone.com/wordpress/list-users/" title="Custom Query: List WordPress Users (November 19, 2008)">Custom Query: List WordPress Users</a> (50)</li>
	<li><a href="http://www.mattvarone.com/wordpress/seo-index-search-engines/" title="WordPress SEO: Control Search Engines (November 24, 2008)">WordPress SEO: Control Search Engines</a> (11)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.mattvarone.com/wordpress/is_subpage-function/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>WordPress SEO: Control Search Engines</title>
		<link>http://www.mattvarone.com/wordpress/seo-index-search-engines/</link>
		<comments>http://www.mattvarone.com/wordpress/seo-index-search-engines/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 00:10:31 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[RESOURCES]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[TIP]]></category>

		<guid isPermaLink="false">http://www.mattvarone.com/?p=571</guid>
		<description><![CDATA[— When you build up a website you should keep in mind how you´ll want search engines to index your content. The main reason you&#8217;ll want to take control is to get all the juice out of your content and prevent possible indexing problems. Although this apply for all sites in this article I&#8217;m going [...]<p>This is a post from: <a href="http://www.mattvarone.com">Matt Varone</a></p>
]]></description>
			<content:encoded><![CDATA[<p>— When you build up a website you should keep in mind how you´ll want search engines to index your content. The main reason you&#8217;ll want to take control is to get all the juice out of your content and prevent possible indexing problems. Although this apply for all sites in this article I&#8217;m going to focus in a WordPress based site situation.</p>
<h3>Why you should control search engines</h3>
<p>It&#8217;s very important to know what and how you want search engines to index your site, if you don&#8217;t take the time to do it you are relying on <em>them</em> to &#8220;figure it out&#8221; for you, and that is not good. In a default WordPress installation you get different instances of your content repeated trough the site. For example take a post. It will appear in the homepage, in it&#8217;s single version, listed under a category, in the author pages, in search result, etc. Are you comfortable having duplicated content indexed and letting Search Engines pick/guess which version of it is the one you consider the most relevant? I bet you wont. Thats why it&#8217;s good to take this into consideration.<br />
<span id="more-571"></span></p>
<h3>What to index</h3>
<p>There&#8217;s a lot of dicussion around the web of what you should and shouldn&#8217;t index. Unfortunately for us there isn&#8217;t one solution that will fit perfectly for all sites, to achieve the best results it will usually require planning ahead and even doing some experimenting and tweaking on the road. The type of content, the blog structure even the theme structure and its elements are things that affects these plans and should be taken into consideration prior making a decision. For example, not all themes will always show duplicate content. If your theme category pages show excerpts of the content that you previously took the time to write, then it certainly is good to index that page. Same thing could happen with tags, author and archives pages as well. If those provide different or extra content then why would you not index them.</p>
<h3>How can you control this?</h3>
<h4>Create a robots.txt file</h4>
<p>Im sure most of you know what a <a href="http://en.wikipedia.org/wiki/Robots.txt">robots.txt</a> file is for. For those who don&#8217;t know, it&#8217;s basically a file that goes in the root folder of your site with instructions of what specific files or directories you want to allow or disallow Search Engines to index. Here is a sample of a WordPress robots.txt file:</p>
<pre class="brush: html">
User-agent: *
Disallow: /tag
Disallow: /author
</pre>
<p>To prevent duplicated content, in the sample above I decided to disallow the indexing of everything under /tag and /author. Remember not all themes/sites should have these same instructions, you have to choose carefully what you&#8217;ll want to remove. As a live example you can see <a href="http://www.mattvarone.com/robots.txt" rel="nofollow">my robots.txt</a> file. If you feel uncomfortable editing files in your server there&#8217;s a nice <a href="http://wordpress.org/extend/plugins/kb-robotstxt">plugin</a> to create this file from within the Admin panel.</p>
<h4>Add the correct robots meta tags to your theme pages</h4>
<p>If you feel you want to have a more specific control, or if you don&#8217;t trust enough your robots.txt file, you can always opt to use the <a href="http://www.robotstxt.org/meta.html">robots meta tag</a>. You can use this tag to tell Search Engines not to index the content of a page, and/or not scan it for links to follow. Joost de Valk has put together a great <a href="http://yoast.com/wordpress/meta-robots-wordpress-plugin/">plugin</a> to handle this easily from within WordPress control panel.</p>
<h3>Conclusion</h3>
<p>Your site might had been loosing relevance in search results because of this so I encourage you to think about it and give it the time it deserves. If you have any tip or suggestion feel free to add it in the comments.</p>
<p>Hope you enjoyed,<br />
Thanks!</p>
<p>This is a post from: <a href="http://www.mattvarone.com">Matt Varone</a></p>

	<h4 class="related">Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.mattvarone.com/wordpress/list-users/" title="Custom Query: List WordPress Users (November 19, 2008)">Custom Query: List WordPress Users</a> (50)</li>
	<li><a href="http://www.mattvarone.com/wordpress/wordpress-textmate-bundle/" title="WordPress Textmate bundle (September 15, 2008)">WordPress Textmate bundle</a> (3)</li>
	<li><a href="http://www.mattvarone.com/web-design/using-stacks-for-screenshots/" title="Using Stacks for Screenshots (September 19, 2008)">Using Stacks for Screenshots</a> (0)</li>
	<li><a href="http://www.mattvarone.com/wordpress/useful-functions-for-wordpress/" title="Useful custom functions for WordPress (November 11, 2008)">Useful custom functions for WordPress</a> (55)</li>
	<li><a href="http://www.mattvarone.com/wordpress/functionsphp-wordpress-themes/" title="Taking Advantage of Functions.php in Wordpress Themes (October 23, 2008)">Taking Advantage of Functions.php in Wordpress Themes</a> (38)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.mattvarone.com/wordpress/seo-index-search-engines/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss><!-- Dynamic page generated in 0.460 seconds. --><!-- Cached page generated by WP-Super-Cache on 2009-07-13 11:42:55 -->
