<?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>Programming Blog &#187; php</title>
	<atom:link href="http://www.neurosoftware.ro/programming-blog/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.neurosoftware.ro/programming-blog</link>
	<description>Web development , php , ajax , symfony, framework, zend</description>
	<lastBuildDate>Thu, 18 Aug 2011 08:11:19 +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>8 New and amazing WordPress hacks</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-new-and-amazing-wordpress-hacks/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-new-and-amazing-wordpress-hacks/#comments</comments>
		<pubDate>Fri, 29 Jul 2011 01:35:37 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[2s]]></category>
		<category><![CDATA[bitstream charter]]></category>
		<category><![CDATA[code snippets]]></category>
		<category><![CDATA[current user]]></category>
		<category><![CDATA[htaccess file]]></category>
		<category><![CDATA[maintenance function]]></category>
		<category><![CDATA[maintenance mode]]></category>
		<category><![CDATA[php source]]></category>
		<category><![CDATA[quot quot]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-new-and-amazing-wordpress-hacks/</guid>
		<description><![CDATA[Easily replace WordPress editor font Don&#8217;t like the default font used by WordPress editor? No problem, the following code will allow you to change it. Simply paste it to your theme functions.php file. You can define which font to use on line 5. add_action( &#039;admin_head-post.php&#039;, &#039;cwc_fix_html_editor_font&#039; ); add_action( &#039;admin_head-post-new.php&#039;, &#039;cwc_fix_html_editor_font&#039; ); function cwc_fix_html_editor_font() { ?&#62; [...]]]></description>
			<content:encoded><![CDATA[<h2>Easily replace WordPress editor font</h2>
<p>Don&#8217;t like the default font used by WordPress editor? No problem, the following code will allow you to change it. Simply paste it to your theme <code>functions.php</code> file. You can define which font to use on line 5.</p>
<pre>
add_action( &#039;admin_head-post.php&#039;, &#039;cwc_fix_html_editor_font&#039; );
add_action( &#039;admin_head-post-new.php&#039;, &#039;cwc_fix_html_editor_font&#039; );

function cwc_fix_html_editor_font() { ?&gt;

&lt;style type=&quot;text/css&quot;&gt;#editorcontainer #content, #wp_mce_fullscreen { font-family: Georgia, &quot;Times New Roman&quot;, &quot;Bitstream Charter&quot;, Times, serif; }&lt;/style&gt;
&lt;?php }
</pre>
<p><strong>Source: <a href="http://devpress.com/blog/fixing-wordpress-3-2s-html-editor-font/">http://devpress.com/blog/fixing-wordpress-3-2s-html-editor-font/</a></strong></p>
<h2>Quick and easy maintenance mode</h2>
<p>Sometimes, you need to put your blog on hold while performing some maintenance. Many plugins are allowing you to do so, but here is a simpler solution: Just paste the following snippet into your <code>functions.php</code> file and save it. Your blog is now unavailable to anyone except administrators. Don&#8217;t forget to remove the code when you&#8217;re done with maintenance!</p>
<pre>
function cwc_maintenance_mode() {
    if ( !current_user_can( &#039;edit_themes&#039; ) || !is_user_logged_in() ) {
        wp_die(&#039;Maintenance, please come back soon.&#039;);
    }
}
add_action(&#039;get_header&#039;, &#039;cwc_maintenance_mode&#039;);
</pre>
<p><strong>Source: <a href="http://skyje.com/2011/05/wordpress-code-snippets/">http://skyje.com/2011/05/wordpress-code-snippets/</a></strong></p>
<h2>Simpler login url</h2>
<p>Would you like to be able to use a simpler url like <code>http://website.com/login</code> to login to your WordPress dashboard? If yes, just read this recipe to learn how to implement it on your own blog.</p>
<p>Open your <code>.htaccess</code> file (located at the root of your WordPress install) and add the following code. <strong>Remember to backup your .htaccess file before editing it!</strong></p>
<pre>
RewriteRule ^login$ http://yoursite.com/wp-login.php [NC,L]
</pre>
<p><strong>Source: <a href="http://www.wprecipes.com/simpler-wordpress-login-url">http://www.wprecipes.com/simpler-wordpress-login-url</a></strong></p>
<h2>Disable theme switching</h2>
<p>When working with clients, it can be good to keep the control of what they can do to prevent possible problems. For example, disabling theme switching can be a good idea, especially if the site you built heavily rely on the theme. To do so, just paste the code below into the <code>functions.php</code> file of the theme. Once done, the client will not be able to switch themes anymore.</p>
<pre>
add_action(&#039;admin_init&#039;, &#039;cwc_lock_theme&#039;);
function cwc_lock_theme() {
	global $submenu, $userdata;
	get_currentuserinfo();
	if ($userdata-&gt;ID != 1) {
		unset($submenu[&#039;themes.php&#039;][5]);
		unset($submenu[&#039;themes.php&#039;][15]);
	}
}
</pre>
<p><strong>Source: <a href="http://sltaylor.co.uk/blog/disabling-wordpress-plugin-deactivation-theme-changing/">http://sltaylor.co.uk/blog/disabling-wordpress-plugin-deactivation-theme-changing/</a></strong></p>
<h2>Disable RSS feed</h2>
<p>By default, WordPress include the popular RSS functionnality, which is great for blogs. But if you&#8217;re using your WordPress install as a static site, having RSS feeds may become a bit confusing for your visitors.</p>
<p>This code will totally disable RSS feeds (As well as other formats) from your blog. Just paste the code into <code>functions.php</code>, and you&#8217;re done.</p>
<pre>
function cwc_disable_feed() {
	wp_die( __(&#039;No feed available,please visit our &lt;a href=&quot;&#039;. get_bloginfo(&#039;url&#039;) .&#039;&quot;&gt;homepage&lt;/a&gt;!&#039;) );
}
add_action(&#039;do_feed&#039;, &#039;cwc_disable_feed&#039;, 1);
add_action(&#039;do_feed_rdf&#039;, &#039;cwc_disable_feed&#039;, 1);
add_action(&#039;do_feed_rss&#039;, &#039;cwc_disable_feed&#039;, 1);
add_action(&#039;do_feed_rss2&#039;, &#039;cwc_disable_feed&#039;, 1);
add_action(&#039;do_feed_atom&#039;, &#039;cwc_disable_feed&#039;, 1);
</pre>
<p><strong>Source: <a href="http://wpengineer.com/287/disable-wordpress-feed/">http://wpengineer.com/287/disable-wordpress-feed/</a></strong></p>
<h2>Filter custom post types by author in admin</h2>
<p>Here is a function which adds a dropdown select control of users next to existing filters (by default, date). It also works in tandem with the built in author filtering which is available when you click on an author in on admin listing pages (by default on posts and pages).</p>
<p>As usual, the only thing you have to do to implement this code is to paste it into your <code>functions.php</code> file.</p>
<pre>
function cwc_restrict_manage_authors() {
        if (isset($_GET[&#039;post_type&#039;]) &amp;&amp; post_type_exists($_GET[&#039;post_type&#039;]) &amp;&amp; in_array(strtolower($_GET[&#039;post_type&#039;]), array(&#039;your_custom_post_types&#039;, &#039;here&#039;))) {
                wp_dropdown_users(array(
                        &#039;show_option_all&#039;       =&gt; &#039;Show all Authors&#039;,
                        &#039;show_option_none&#039;      =&gt; false,
                        &#039;name&#039;                  =&gt; &#039;author&#039;,
                        &#039;selected&#039;              =&gt; !empty($_GET[&#039;author&#039;]) ? $_GET[&#039;author&#039;] : 0,
                        &#039;include_selected&#039;      =&gt; false
                ));
        }
}
add_action(&#039;restrict_manage_posts&#039;, &#039;cwc_restrict_manage_authors&#039;);
</pre>
<p><strong>Source: <a href="http://forrst.com/posts/WordPress_Custom_Post_Types_Filter_by_Author_in-s9p">http://forrst.com/posts/WordPress_Custom_Post_Types_Filter_by_Author_in-s9p</a></strong></p>
<h2>Add post thumbnails to RSS feed</h2>
<p>This very cool piece of code will get the post thumbnail and automatically add it to your RSS feeds. Paste the code into <code>functions.php</code> and save the file. Don&#8217;t forget that you need to use a theme that supports <a href="http://codex.wordpress.org/Post_Thumbnails">post thumbnails</a> for this snippet to work.</p>
<pre>
function cwc_rss_post_thumbnail($content) {
    global $post;
    if(has_post_thumbnail($post-&gt;ID)) {
        $content = &#039;&lt;p&gt;&#039; . get_the_post_thumbnail($post-&gt;ID) .
        &#039;&lt;/p&gt;&#039; . get_the_content();
    }

    return $content;
}
add_filter(&#039;the_excerpt_rss&#039;, &#039;cwc_rss_post_thumbnail&#039;);
add_filter(&#039;the_content_feed&#039;, &#039;cwc_rss_post_thumbnail&#039;);
</pre>
<p><strong>Source: <a href="http://snipplr.com/view.php?codeview&amp;id=56180">http://snipplr.com/view.php?codeview&#038;id=56180</a></strong></p>
<h2>Remove WordPress admin bar</h2>
<p>Introduced in WordPress 3.X, the new &#8220;Admin bar&#8221; is an useful feature, but if you don&#8217;t like it, you can easily remove it. Just paste the following snippet into your <code>functions.php</code> file.</p>
<pre>
add_filter('show_admin_bar', '__return_false');
</pre>
<p><strong>Source: <a href="http://speckyboy.com/2011/03/01/how-to-remove-the-admin-bar-from-wordpress-3-1/">http://speckyboy.com/2011/03/01/how-to-remove-the-admin-bar-from-wordpress-3-1/</a></strong></p>
<p> <img src="http://feeds.feedburner.com/~r/Catswhocode/~4/cHtauD9twQY" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-new-and-amazing-wordpress-hacks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10 super useful tools for JavaScript developers</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-super-useful-tools-for-javascript-developers/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-super-useful-tools-for-javascript-developers/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 10:50:07 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[browser bar]]></category>
		<category><![CDATA[code test]]></category>
		<category><![CDATA[digital libraries]]></category>
		<category><![CDATA[endless possibilities]]></category>
		<category><![CDATA[javascript developers]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[mcgill ca]]></category>
		<category><![CDATA[media queries]]></category>
		<category><![CDATA[most common tasks]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-super-useful-tools-for-javascript-developers/</guid>
		<description><![CDATA[MicroJS Need a piece of code quickly? MicroJS is a brand new site which aim to provide JavaScript code snippet for most common tasks: Ajax, Json, DOM, Object-Oriented JavaScript, and more. A true gold mine to have in your bookmarks! Visit http://microjs.com/ Diva.js Diva is a Javascript frontend for viewing documents, designed to work with [...]]]></description>
			<content:encoded><![CDATA[<h2>MicroJS</h2>
<p><img src="http://www.catswhocode.com/blog/wp-content/uploads/2011/06/microjs.png" alt="" /><br /> Need a piece of code quickly? MicroJS is a brand new site which aim to provide JavaScript code snippet for most common tasks: Ajax, Json, DOM, Object-Oriented JavaScript, and more. A true gold mine to have in your bookmarks!<br /> <strong>Visit <a href="http://microjs.com">http://microjs.com/</a></strong></p>
<h2>Diva.js</h2>
<p><img src="http://www.catswhocode.com/blog/wp-content/uploads/2011/06/divajs.png" alt="" /><br /> Diva is a Javascript frontend for viewing documents, designed to work with digital libraries to present multi-page documents as a single, continuous item. It is designed to work with a <a href="http://iipimage.sourceforge.net/">IIPImage server</a> and will be an awesome tool for those working on library or bookstore websites. A demo is available <a href="http://ddmal.music.mcgill.ca/diva/demo/">here</a> if you want to have a look.<br /> <strong>Visit <a href="http://ddmal.music.mcgill.ca/diva/">http://ddmal.music.mcgill.ca/diva/</a></strong></p>
<h2>Bookmarklet Generator</h2>
<p><img src="http://www.catswhocode.com/blog/wp-content/uploads/2011/06/bookmarklet.png" alt="" /><br /> As you can guess, this tool is a bookmarklet generator: Simply paste your regular JavaScript code, press the button and you&#8217;ll get a bookmarklet &#8211; ready to be installed on your browser bar.<br /> <strong>Visit <a href="http://benalman.com/code/test/jquery-run-code-bookmarklet">http://benalman.com/code/test/jquery-run-code-bookmarklet/</a></strong></p>
<h2>jQAPI</h2>
<p><img src="http://www.catswhocode.com/blog/wp-content/uploads/2011/06/jqapi.png" alt="" /><br /> Like any other jQuery developers, I spend a large amount of time digging in the documentation. jQAPI is a website which provides the jQuery documentation in a more user-friendly way, so it is now my reference site when I need any jQuery help.<br /> <strong>Visit <a href="http://jqapi.com/">http://jqapi.com</a></strong></p>
<h2>heatmap.js</h2>
<p><img src="http://www.catswhocode.com/blog/wp-content/uploads/2011/06/heatmap.png" alt="" /><br /> Day after day, JavaScript continues to surprise me with its endless possibilities: For example, heatmap.js allows you to generate web heatmaps with the html5canvas element based on your data. Easy and efficient!<br /> <strong>Visit <a href="http://www.patrick-wied.at/static/heatmapjs/">http://www.patrick-wied.at/static/heatmapjs/</a></strong></p>
<h2>Respond.js</h2>
<p><img src="http://www.catswhocode.com/blog/wp-content/uploads/2011/06/respond.png" alt="" /><br /> Remember my article about <a href="http://www.catswhocode.com/blog/create-an-adaptable-website-layout-with-css3-media-queries">adaptable layouts</a> with CSS3 media queries? Respond.js is a small script that allow you to use CSS3 media queries on browsers that do not support it yet (Yes IE, we&#8217;re looking at you&#8230;).<br /> <strong>Visit <a href="https://github.com/scottjehl/Respond/blob/master/respond.min.js">https://github.com/scottjehl/Respond/blob/master/respond.min.js</a></strong></p>
<h2>Modernizr</h2>
<p><img src="http://www.catswhocode.com/blog/wp-content/uploads/2011/06/modernizr.png" alt="" /><br /> Modernizr is a script that helps older browsers to work almost as good as newest ones, so you can build modern applications that will work on IE6 and 7. Your clients will love it, that&#8217;s guaranteed.<br /> <strong>Visit <a href="http://www.modernizr.com/">http://www.modernizr.com/</a></strong></p>
<h2>YepNope</h2>
<p><img src="http://www.catswhocode.com/blog/wp-content/uploads/2011/06/yepnope.png" alt="" /><br /> YepNope aim is pretty simple: It answers <em>yep</em>, or <em>nope</em>. For example, ask YepNope is Modernizr is loaded. If yes, ask YepNope to do this, and if not, ask YepNope to do that. That&#8217;s simple as that, and very useful in many cases.<br /> <strong>Visit <a href="http://yepnopejs.com/">http://yepnopejs.com/</a></strong></p>
<h2>Ligature.js</h2>
<p><img src="http://www.catswhocode.com/blog/wp-content/uploads/2011/06/ligature.png" alt="" /><br /> Ligature.js is, unsurprisingly, a script that adds pretty ligatures to any kind of text. A must-have for all typography lovers out here!<br /> <strong>Visit <a href="http://code.google.com/p/ligature-js/">http://code.google.com/p/ligature-js/</a></strong></p>
<h2>FitText.js</h2>
<p><img src="http://www.catswhocode.com/blog/wp-content/uploads/2011/06/fittext.png" alt="" /><br /> FitText is a very interesting tool, that allows the automatic resizing of a text regarding the size of its parent element. Just have a look to the website and resize your browser: The text will fit. Another very interesting tool for modern websites and applications!<br /> <strong>Visit <a href="http://fittextjs.com/">http://fittextjs.com/</a></strong></p>
<p> <img src="http://feeds.feedburner.com/~r/Catswhocode/~4/HBe1V-3-j20" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-super-useful-tools-for-javascript-developers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amazing CSS3 techniques you should know</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/amazing-css3-techniques-you-should-know/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/amazing-css3-techniques-you-should-know/#comments</comments>
		<pubDate>Tue, 07 Jun 2011 00:00:07 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[browser width]]></category>
		<category><![CDATA[css tricks]]></category>
		<category><![CDATA[informative tutorial]]></category>
		<category><![CDATA[mask image]]></category>
		<category><![CDATA[mask images]]></category>
		<category><![CDATA[media queries]]></category>
		<category><![CDATA[mobile design]]></category>
		<category><![CDATA[png image]]></category>
		<category><![CDATA[unfortunely]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/amazing-css3-techniques-you-should-know/</guid>
		<description><![CDATA[Color animate any shape with CSS3 and a PNG Let&#8217;s start this compilation with an interesting effect created using only CSS3: A png image with a changing background. The background is using CSS3 transitions. Not the kind of effect you&#8217;ll put on your website, but definitely an interesting demo of what CSS3 can do. View [...]]]></description>
			<content:encoded><![CDATA[<h2>Color animate any shape with CSS3 and a PNG</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/354a6_css3-color-animate.png" alt="" /><br /> Let&#8217;s start this compilation with an interesting effect created using only CSS3: A png image with a changing background. The background is using CSS3 transitions. Not the kind of effect you&#8217;ll put on your website, but definitely an interesting demo of what CSS3 can do.<br /> <strong>View source: <a href="http://jsfiddle.net/chriscoyier/vhKhT/">http://jsfiddle.net/chriscoyier/vhKhT/</a></strong></p>
<h2>Create adaptable layout using CSS3 media queries</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/33338_adaptive-layout.png" alt="" /><br /> CSS3 media queries allow you to adapt a web layout to the browser width. Which means that you can easily create an adaptable layout that fits both big displays and mobile devices. You probably already checked <a href="http://www.catswhocode.com/blog/create-an-adaptable-website-layout-with-css3-media-queries">my article on that subject</a>, so I&#8217;ve picked another informative tutorial written by webdesigner Nick La. A technique any web developer should know!<br /> <strong>View tutorial: <a href="http://webdesignerwall.com/tutorials/adaptive-mobile-design-with-css3-media-queries">http://webdesignerwall.com/tutorials/adaptive-mobile-design-with-css3-media-queries</a></strong></p>
<h2>Dim entire page when certain link is rolled over, css way</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/33338_dim-page.png" alt="" /><br /> Very cool for web apps: Once a particular link is rolled over, the rest of the page is dimmed. This technique may also be a starting point for other great experiments.<br /> <strong>View source: <a href="http://jsfiddle.net/chriscoyier/pVsKe/1/">http://jsfiddle.net/chriscoyier/pVsKe/1/</a></strong></p>
<h2>Clipping text with CSS3 text-overflow</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/33338_elipsis.png" alt="" /><br /> <code>text-overflow</code> is a new CSS3 property which allows you to define how to handle a text which is bigger than its container. This example will show you anything you need to know about this property. Unfortunely, as I&#8217;m writing this post <code>text-overflow</code> is only supported by Opera and IE9.<br /> <strong>View source: <a href="http://www.456bereastreet.com/archive/201105/clipping_text_with_css3_text-overflow/">http://www.456bereastreet.com/archive/201105/clipping_text_with_css3_text-overflow/</a></strong></p>
<h2>Full Browser Width Bars</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/2f5bb_css3-full-bars.png" alt="" /><br /> Another goldie from Chris Coyier: In this tutorial, he&#8217;ll teach you how to create full browser width bars easily.<br /> <strong>View source: <a href="http://css-tricks.com/examples/FullBrowserWidthBars/">http://css-tricks.com/examples/FullBrowserWidthBars/</a></strong></p>
<h2>CSS Mask-Image &#038; Text</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/2f5bb_css-mask-image-text.png" alt="" /><br /> A great text effect using CSS3 and mask images. Unfortunately, the effect is not supported by some browsers, but it degrades gracefully. This effect will probably be very popular when CSS3 will be fully supported by all major browsers.<br /> <strong>View source: <a href="http://trentwalton.com/2011/05/19/mask-image-text/">http://trentwalton.com/2011/05/19/mask-image-text/</a></strong></p>
<h2>Image slider with CSS3 transitions</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/e6d3f_css3-transitions.png" alt="" /><br /> Who&#8217;s never heard of JavaScript sliders, such as NivoSlider? That kind of effect is very popular for the past two or three years. With the new CSS3 animations, it is now possible to enhance transitions between images. This tool, called Flux Slider, supports either jQuery or Zepto.js. It works on any browser supporting CSS3 transitions.<br /> <strong>View source: <a href="http://blog.joelambert.co.uk/2011/05/05/flux-slider-css3-animation-based-image-transitions/">http://blog.joelambert.co.uk/2011/05/05/flux-slider-css3-animation-based-image-transitions/</a></strong></p>
<h2>Flared Borders with CSS</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/2eacd_css3-flared-borders.png" alt="" /><br /> Remember that time when you had to create images just to display a box with rounded corners? Thanks to the <code>border-radius</code>, this painful process is no longer needed. This very cool tutorial will show you how to create an element that flares into another using only CSS. The whole code degrades gracefully in older browsers.<br /> <strong>View source: <a href="http://orderedlist.com/blog/articles/flared-borders-with-css/">http://orderedlist.com/blog/articles/flared-borders-with-css/</a></strong></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/2eacd_OpDn1Ymf-JI" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/amazing-css3-techniques-you-should-know/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>10 useful .htaccess snippets to have in your toolbox</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-htaccess-snippets-to-have-in-your-toolbox/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-htaccess-snippets-to-have-in-your-toolbox/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 23:57:35 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[css tricks]]></category>
		<category><![CDATA[custom error]]></category>
		<category><![CDATA[example urls]]></category>
		<category><![CDATA[jpe]]></category>
		<category><![CDATA[mysite com]]></category>
		<category><![CDATA[png images]]></category>
		<category><![CDATA[rewriterule]]></category>
		<category><![CDATA[www prefix]]></category>
		<category><![CDATA[www version]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-htaccess-snippets-to-have-in-your-toolbox/</guid>
		<description><![CDATA[Before editing your .htaccess file, always make a backup so you can restore it if needed. Remove www in url For SEO reasons, you might always remove (or use) the www prefix in your urls. The following snippet will remove the www from your website url and redirect any url with the www to the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Before editing your .htaccess file, always make a backup so you can restore it if needed.</strong></p>
<h2>Remove www in url</h2>
<p>For SEO reasons, you might always remove (or use) the <em>www</em> prefix in your urls. The following snippet will remove the <em>www</em> from your website url and redirect any url with the <em>www</em> to the non-www version.</p>
<pre>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^your-site.com$ [NC]
RewriteRule ^(.*)$ http://your-site.com/$1 [L,R=301]
</pre>
<p><strong>Source: <a href="http://css-tricks.com/snippets/htaccess/www-no-www/">http://css-tricks.com/snippets/htaccess/www-no-www/</a></strong></p>
<h2>Prevent hotlinking</h2>
<p>Hotlinking is a bad practice that consist of using the images from another site on yours. When you&#8217;re hotlinked by someone else, your bandwidth is used for someone else profit. Of course, you may want to prevent hotlinkers. Just add the following snippet to your <code>.htaccess</code> file after replacing the example urls by your own urls.</p>
<pre>
RewriteEngine On
#Replace ?mysite\.com/ with your blog url
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
#Replace /images/nohotlink.jpg with your &quot;don&#039;t hotlink&quot; image url
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpg [L]
</pre>
<p><strong>Source: <a href="http://www.catswhocode.com/blog"></a></strong></p>
<h2>Redirect all WordPress feeds to feedburner</h2>
<p>Most bloggers are using Feedburner, a web service that lets you know how many people are reading your blog via feeds. If you&#8217;re using WordPress, you should redirect all WordPress feeds (rss, atom, etc) to your feedburner feed. Modify lines 2 and 3, and  then paste this code to your <code>.htaccess</code> file.</p>
<pre>
&lt;IfModule mod_alias.c&gt;
 RedirectMatch 301 /feed/(atom|rdf|rss|rss2)/?$ http://feedburner.com/yourfeed/
 RedirectMatch 301 /comments/feed/(atom|rdf|rss|rss2)/?$ http://feedburner.com/yourfeed/
&lt;/IfModule&gt;
</pre>
<p><strong>Source: <a href="http://www.wprecipes.com/how-to-redirect-wordpress-rss-feeds-to-feedburner-with-htaccess">http://www.wprecipes.com/how-to-redirect-wordpress-rss-feeds-to-feedburner-with-htaccess</a></strong></p>
<h2>Create custom error pages</h2>
<p>Tired of the old errors pages of your site? Just create some html files with the look you want, upload them to your server, and add the following to your <code>.htaccess</code> file:</p>
<pre>
ErrorDocument 400 /errors/badrequest.html
ErrorDocument 401 /errors/authreqd.html
ErrorDocument 403 /errors/forbid.html
ErrorDocument 404 /errors/notfound.html
ErrorDocument 500 /errors/serverr.html
</pre>
<p><strong>Source: <a href="http://css-tricks.com/snippets/htaccess/custom-error-pages/">http://css-tricks.com/snippets/htaccess/custom-error-pages/</a></strong></p>
<h2>Force download of specific files</h2>
<p>When offering some files such as mp3s, eps or xls, for download on your site, you may force download instead of letting the browser decide what to do.<br /> This snippet will force the download of <code>.xls</code> and <code>.eps</code> files from your server.</p>
<pre>
&lt;Files *.xls&gt;
  ForceType application/octet-stream
  Header set Content-Disposition attachment
&lt;/Files&gt;
&lt;Files *.eps&gt;
  ForceType application/octet-stream
  Header set Content-Disposition attachment
&lt;/Files&gt;
</pre>
<p><strong>Source: <a href="http://www.givegoodweb.com/post/30/forcing-a-download-with-apache-and-htaccess">http://www.givegoodweb.com/post/30/forcing-a-download-with-apache-and-htaccess</a></strong></p>
<h2>Log PHP errors</h2>
<p>This snippet is an interesting way to log errors from your php file into a log file. Just create a php_error.log file somewhere on your server, and add the snippet to your .htaccess file. Don&#8217;t forget to modify the log file location on line 7.</p>
<pre>
# display no errs to user
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
# log to file
php_flag log_errors on
php_value error_log /location/to/php_error.log
</pre>
<p><strong>Source: <a href="http://css-tricks.com/snippets/htaccess/php-error-logging/">http://css-tricks.com/snippets/htaccess/php-error-logging/</a></strong></p>
<h2>Remove file extensions from urls</h2>
<p>File extensions may be useful to developers, but there&#8217;s absolutely no need for your site visitors to be able to see them. This snippet will remove the <code>.html</code> extension on any <code>html</code> files. Of course, this code can be easily adapted to remove extensions from other file extensions such as php.</p>
<pre>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
# Replace html with your file extension, eg: php, htm, asp
</pre>
<p><strong>Source: <a href="http://eisabainyo.net/weblog/2007/08/19/removing-file-extension-via-htaccess/">http://eisabainyo.net/weblog/2007/08/19/removing-file-extension-via-htaccess</a></strong></p>
<h2>Prevent directory listing</h2>
<p>On your web server, when a directory do not have an index file, Apache automatically create a list of all files from the current directory. If you do not wish that anyone can see which files are on your server, just add the following code to your <code>.htaccess</code> file to prevent automatic directory listing.</p>
<pre>
Options -Indexes
</pre>
<h2>Reduce pages weight by compressing static data</h2>
<p>Do you know that it is possible to send compressed data to the visitors, which will be decompressed by the client? This code will definitely save you (and your visitor) bandwidth and reduce your pages weight.</p>
<pre>
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
</pre>
<h2>Automatically add utf-8 charset to files</h2>
<p>In order to avoid encoding problems, you can force a specific encoding directly on your .htaccess file. That way, you&#8217;ll ensure that your html documents will always render correctly, even if your forget to add a <code>&lt;meta http-equiv="Content-Type"&gt;</code> directive on your html pages.</p>
<pre>
&lt;FilesMatch &quot;\.(htm|html|css|js)$&quot;&gt;
AddDefaultCharset UTF-8
&lt;/FilesMatch&gt;
</pre>
<p><strong>Source: <a href="http://www.askapache.com/htaccess/setting-charset-in-htaccess.html">http://www.askapache.com/htaccess/setting-charset-in-htaccess.html</a></strong></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/344b4_9yCkmE1Eqjw" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-htaccess-snippets-to-have-in-your-toolbox/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to create offline HTML5 web apps in 5 easy steps</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-offline-html5-web-apps-in-5-easy-steps/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-offline-html5-web-apps-in-5-easy-steps/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 23:57:26 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[cache index]]></category>
		<category><![CDATA[css image]]></category>
		<category><![CDATA[doctype html]]></category>
		<category><![CDATA[fallback]]></category>
		<category><![CDATA[image jpg]]></category>
		<category><![CDATA[media queries]]></category>
		<category><![CDATA[network search]]></category>
		<category><![CDATA[style css]]></category>
		<category><![CDATA[web apps]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-offline-html5-web-apps-in-5-easy-steps/</guid>
		<description><![CDATA[Getting started View Demo Download files 1 &#8211; Add HTML5 doctype The first thing to do is create a valid HTML5 document. The HTML5 doctype is easier to remember than ones used for xhtml: &#60;!DOCTYPE html&#62; &#60;html&#62; ... Create a file named index.html, or get the example files from my CSS3 media queries article to [...]]]></description>
			<content:encoded><![CDATA[<h2>Getting started</h2>
<ul>
<li><a href="http://www.catswhocode.com/demos/html5-offline-cache/">View Demo</a></li>
<li><a href="http://www.catswhocode.com/blog/wp-content/uploads/2011/05/html5-offline-cache.zip">Download files</a></li>
</ul>
<h2>1 &#8211; Add HTML5 doctype</h2>
<p>The first thing to do is create a valid HTML5 document. The HTML5 doctype is easier to remember than ones used for xhtml:</p>
<pre>
&lt;!DOCTYPE html&gt;
&lt;html&gt;
  ...
</pre>
<p>Create a file named <code>index.html</code>, or get the example files from my <a href="http://www.catswhocode.com/blog/create-an-adaptable-website-layout-with-css3-media-queries">CSS3 media queries</a> article to use as a basis for this tutorial.<br /> In case you need it, the full HTML5 specs are available <a href="http://dev.w3.org/html5/spec/Overview.html">on the W3C website</a>.</p>
<h2>2 &#8211; Add .htaccess support</h2>
<p>The file we&#8217;re going to create to cache our web page is called a <code>manifest</code> file. Before creating it, we first have to add a directive to the <code>.htaccess</code> file (assuming your server is Apache).</p>
<p>Open the <code>.htaccess</code> file, which is located on your website root, and add the following code:</p>
<pre>
AddType text/cache-manifest .manifest
</pre>
<p>This directive makes sure that every <code>.manifest</code> file is served as text/cache-manifest. If the file isn&#8217;t, then the whole manifest will have no effect and the page will not be available offline.</p>
<h2>3 &#8211; Create the manifest file</h2>
<p>Now, things are going to be more interesting as we create a <code>manifest</code> file. Create a new file and save it as <code>offline.manifest</code>. Then, paste the following code in it. I&#8217;ll explain it later.</p>
<pre>
CACHE MANIFEST
#This is a comment

CACHE
index.html
style.css
image.jpg
image-med.jpg
image-small.jpg
notre-dame.jpg
</pre>
<p>Right now, you have a perfectly working <code>manifest</code> file. The way it works is very simple: After the <code>CACHE</code> declaration, you have to list each files you want to make available offline. That&#8217;s enough for caching a simple web page like the one from my example, but HTML5 caching has other interesting possibilities.</p>
<p>For example, consider the following <code>manifest</code> file:</p>
<pre>
CACHE MANIFEST
#This is a comment

CACHE
index.html
style.css

NETWORK:
search.php
login.php

FALLBACK:
/api offline.html
</pre>
<p>Like in the example <code>manifest</code> file, we have a <code>CACHE</code> declaration that caches index.html and style.css. But we also have the <code>NETWORK</code> declaration, which is used to specify files that shouldn&#8217;t be cached, such as a login page.</p>
<p>The last declaration is <code>FALLBACK</code>. This declaration allows you to redirect the user to a particular file (in this example, <code>offline.html</code>) if a resource (/api) isn&#8217;t available offline.</p>
<h2>4 &#8211; Link your manifest file to the html document</h2>
<p>Now, both your <code>manifest</code> file and your main html document are ready. The only thing you still have to do is to link the <code>manifest</code> file to the html document.</p>
<p>Doing this is easy: simply add the <code>manifest</code> attribute to the <code>html</code> element as shown below:</p>
<pre>
&lt;html manifest=&quot;/offline.manifest&quot;&gt;
</pre>
<h2>5 &#8211; Test it</h2>
<p>Once done, you&#8217;re ready to go. If you visit your <code>index.html</code> file with Firefox 3.5+, you should see a banner like this one:<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/37dce_firefox_offline.png" alt="" /></p>
<p>Other browser I&#8217;ve tested (Chrome, Safari, Android and iPhone) do not warn about the file caching, and the file is automatically cached.</p>
<p>Below you&#8217;ll find the browser compatibility of this technique: As usual Internet Explorer does not support it.</p>
<ul>
<li>IE: No support</li>
<li>Firefox: 3.5+</li>
<li>Safari: 4.0+</li>
<li>Chrome: 5.0+</li>
<li>Opera: 10.6+</li>
<li>iPhone: 2.1+</li>
<li>Android: 2.0+</li>
</ul>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/37dce_at9YW_JIpJc" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-offline-html5-web-apps-in-5-easy-steps/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>10 tips for creating high quality WordPress themes</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-tips-for-creating-high-quality-wordpress-themes/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-tips-for-creating-high-quality-wordpress-themes/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 23:56:56 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Althought]]></category>
		<category><![CDATA[consistent style]]></category>
		<category><![CDATA[css standards]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[open source projects]]></category>
		<category><![CDATA[php tags]]></category>
		<category><![CDATA[style convention]]></category>
		<category><![CDATA[valid html]]></category>
		<category><![CDATA[w3c html]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-tips-for-creating-high-quality-wordpress-themes/</guid>
		<description><![CDATA[Respect HTML and CSS standards This statement may sound pretty obvious, but actually many publicly available themes don&#8217;t pass W3C HTML or CSS validation. When building a theme, it is important to respect HTML and CSS standards so your code will be clean and (mostly) cross-browser compatible. A valid HTML/CSS theme is also a proof [...]]]></description>
			<content:encoded><![CDATA[<h2>Respect HTML and CSS standards</h2>
<p>This statement may sound pretty obvious, but actually many publicly available themes don&#8217;t pass W3C HTML or CSS validation. When building a theme, it is important to respect HTML and CSS standards so your code will be clean and (mostly) cross-browser compatible. A valid HTML/CSS theme is also a proof of quality development.</p>
<p>HTML, XHTML and HTML5 code can be checked on the<a href="http://validator.w3.org/">W3C website</a>. The W3C also have a free <a href="http://jigsaw.w3.org/css-validator/">tool to check your CSS coding</a>, althought with the rise of CSS3 and its vendor prefixes, it is pretty hard to obtain a 100% valid stylesheet.</p>
<h2>Respect WordPress coding standards</h2>
<p>Like most other open-source projects, WordPress have its own list of coding standards. This meticulous coding style convention is here to keep harmony among the thousands of themes and plugins availables and maintain a consistent style so the code can become clean and easy to read at a glance.</p>
<p>For example, the coding convention forbids to use PHP shorthand tag:</p>
<pre>
&lt;? ... ?&gt;
&lt;?=$var?&gt;
</pre>
<p>Instead, use full PHP tags:</p>
<pre>
&lt;?php $var; ?&gt;
</pre>
<p>The complete coding standard guide can be read on <a href="http://codex.wordpress.org/WordPress_Coding_Standards">WordPress codex</a>. On a personnal note, I really think that WordPress should recommend coding CSS in &#8220;blocks&#8221; instead of &#8220;lines&#8221;.</p>
<h2>Don&#8217;t forget wp_head()</h2>
<p>Within the <code>&lt;head&gt;</code> and <code>&lt;/head&gt;</code> tags of most WordPress themes, you&#8217;ll find a function named <code>wp_head()</code>. This function may look useless to newcommers, but it is extremely important: Many plugins use this function to &#8220;hook&#8221; code in WordPress header. Without this function within your <code>&lt;head&gt;</code> and <code>&lt;/head&gt;</code> tags, lots of plugins will not be able to work.</p>
<p>A similar function named <code>wp_footer();</code> can be found in the <code>footer.php</code> file of most themes. Don&#8217;t forget it as well, it is used by plugins to hook code in your theme footer. For example, analytics.</p>
<h2>Be careful when including hacks</h2>
<p>Do you know my blog <a href="http://www.wprecipes.com">WPRecipes</a>? In case you don&#8217;t, it is a place where I share WordPress hacks and code snippets. The site is quite popular among the community and I&#8217;m happy that many people seems to enjoy my hacks.</p>
<p>But last year, Gravity Forms developer Carl Hancock let me know that one of my hacks (Named <a href="http://www.wprecipes.com/disable-wordpress-automatic-formatting-on-posts-using-a-shortcode">Disable WordPress automatic formatting on posts using a shortcode</a>) was intensively used on themes sold at <a href="http://www.themeforest.net/?ref=jbj">Themeforest</a>, and caused conflicts with Gravity Forms.</p>
<p>Of course, I felt sorry for the countless hours Carl and his team wasted in support due to the conflict between their plugin, and my hack. This is why hacks may be used on your own theme, or on a client theme, but <strong>you should not include hacks in a theme you&#8217;re going to distribute, excepted if you know exactly what you&#8217;re doing</strong>.</p>
<h2>Start from something solid</h2>
<p>In order to save time, most developers prefer starting coding from an existing theme. For example, I&#8217;ve used Cris Coyier&#8217;s <a href="http://digwp.com/2010/02/blank-wordpress-theme/">Blank Theme</a> as the starting point of most of the themes I&#8217;ve created in 2010 and 2011.</p>
<p>But don&#8217;t start from a finished plugin. I&#8217;ve seen themes coded over WooThemes and then re-released. Let me tell you, the code was an absolute nightmare!</p>
<p>If you&#8217;re looking for a rock solid basis to create your theme, give a go to <a href="http://constellationtheme.com/">Constellation</a>: It is a &#8220;blank&#8221; HTML5/CSS3 theme, which the current CatsWhoCode theme derives from.</p>
<h2>Use localized strings</h2>
<p>When coding a WordPress theme or plugin, you have to think about those that doesn&#8217;t speak English. Using the PHP language, two very useful functions are available for you to create a translatable theme or plugin:</p>
<p>The first is the function <code>_e()</code>, which prints on screen the desired text, translated into the user language:</p>
<pre>_e("Text to translate", "textdomain");</pre>
<p>The second is <code>__() </code>wich is basically the same than <code>_e()</code>, but returns the text:</p>
<pre>function say_something() {
    return __("Text to translate", "textdomain");
}</pre>
<p>By using those functions, you make your work translatable in any language, which is a very great thing for people that blog in another language than English. Don&#8217;t forget to read my guide about making <a href="http://www.catswhocode.com/blog/easily-create-multilingual-sites-with-wordpress">multilingual WordPress themes</a> if you want to know more about the topic.</p>
<h2>Prefix your php functions</h2>
<p>It may looks like a detail at first, but prefixing your php functions is always a good practice. Why? Because most people would name their functions using common names such as <em>display_stuff()</em>. And if a theme developer named one of his functions with the same name that a function from a plugin the end user is using&#8230; Boom, the site is broken, and the user is not happy.</p>
<p>A bad example is to name your functions like this:</p>
<pre>
function display_stuff($stuff){
...
}
</pre>
<p>Instead, add a prefix such as your initials:</p>
<pre>
function cwc_display_stuff($stuff){
...
}
</pre>
<p>It do not require a big effort and it can avoid big problems for the non tech-savvy user.</p>
<h2>Test content formating</h2>
<p>A blog is used to display content. Then, why so many available themes do not comes with a style for HTML lists or blockquotes? To make sure users will be happy with your theme, you should make sure that all HTML elements looks good.</p>
<p>To do so, you can use a plugin named <a href="http://wordpress.org/extend/plugins/wp-dummy-content/">WP Dummy Content</a>, which allow you to create posts, pages, categories and more so you can check how good you theme looks when it&#8217;s full of content.</p>
<p>Another tool to have in your tool box is the <a href="http://thinkdesignblog.com/wordpress-lorem-ipsum-test-post-pack.htm">WP Lorem Ipsum Post Pack</a>, a XML file that contains categories, sub-categories, pages, sub-pages, 30 test posts, tags, thumbnails via custom fields, and a &#8220;Testing the Elements&#8221; post so that you can test html elements, such as <code>&lt;h2&gt;</code>, <code>&lt;blockquote&gt;</code>, so you can test your theme in depth. Importing this XML is easy: Login to your dashboard, navigate to Tools &rarr; Import, and select the file.</p>
<h2>Make sure your theme supports the latests functions</h2>
<p>Do you think your theme is ready for public distribution? If yes, you should always make a final checking using the <a href="http://wordpress.org/extend/plugins/theme-check">Theme-Check plugin</a>, which is an easy way to test your theme and make sure it&#8217;s up to spec with the latest theme review standards.</p>
<p><a href="http://wordpress.org/extend/plugins/theme-check">Theme Check</a> can be installed as any other plugins, and will let you know about any coding mistakes such as the use of a deprecated function.</p>
<h2>Release your theme as GPL</h2>
<p>With the success of WordPress, people created companies and started to sell &#8220;premium&#8221; themes. Most of them with released under the terms of the GPL licence, but several theme vendors chose to go with a licence that may, in their opinion, give them a better protection against piracy.</p>
<p>Though, WordPress team stated numerous times that themes <a href="http://wordpress.org/news/2009/07/themes-are-gpl-too/">have to be GPL compliant</a>.</p>
<p>Although I am not a GPL fanatic, most WordPress users are, and trying to release a theme that is not GPL compliant will make you a pariah, and might even get you a lawsuit. So, don&#8217;t do something stupid: Respect WordPress licence, or choose another platform to work on.</p>
<p><em>Any other useful tip? Feel free to share it in a comment!</em></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/cc2e2_7KbR_UaNqmA" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-tips-for-creating-high-quality-wordpress-themes/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>10+ useful tools to simplify CSS3 development</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-tools-to-simplify-css3-development/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-tools-to-simplify-css3-development/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 23:56:45 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[button design]]></category>
		<category><![CDATA[css code]]></category>
		<category><![CDATA[css file]]></category>
		<category><![CDATA[drop shadow]]></category>
		<category><![CDATA[inline css]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[photoshop effects]]></category>
		<category><![CDATA[text shadow]]></category>
		<category><![CDATA[true time]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-tools-to-simplify-css3-development/</guid>
		<description><![CDATA[CSS3 Pie Are you surprised that Internet Explorer 6/8 CSS3 support is almost non existent? I guess most of you aren&#8217;t. Unfortunately, some clients may want you to create a website that look like in a modern browser in IE. This is when CSS3 Pie is useful: It allows you to use most of the [...]]]></description>
			<content:encoded><![CDATA[<h2>CSS3 Pie</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/6bc13_css3-tools-1.png" alt="" /><br /> Are you surprised that Internet Explorer 6/8 CSS3 support is almost non existent? I guess most of you aren&#8217;t. Unfortunately, some clients may want you to create a website that look like in a modern browser in IE. This is when CSS3 Pie is useful: It allows you to use most of the CSS3 cool features on IE.<br /> <strong>&rarr; Visit <a href="http://css3pie.com/">CSS3 Pie</a></strong></p>
<h2>CSS3 Builder</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/6bc13_css3-tools-11.png" alt="" /><br /> With this tool, you can design complex CSS3 boxes using an interface looking exactly like the one used for applying Photoshop effects. Definitely a great tool to save lots of time.<br /> <strong>&rarr; Visit <a href="http://www.layerstyles.org/builder.html">CSS3 Builder</a></strong></p>
<h2>CSS3 Drop shadow generator</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/d705d_css3-tools-12.png" alt="" /><br /> This one is quite similar to CSS3 builder, just use the sliders to visually design your drop shadow. Once done, just copy the CSS code which have been automatically created. Paste it to your css file, and you&#8217;re ready to go!<br /> <strong>&rarr; Visit <a href="http://www.wordpressthemeshock.com/css-drop-shadow/">CSS3 Drop shadow generator</a></strong></p>
<h2>Cascader</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/d705d_css3-tools-2.png" alt="" /><br /> This tool isn&#8217;t CSS3 specific, but it is so useful that it would have been a shame not to include it on that list. Cascader lets you input some HTML code and it will detect all inline CSS, remove it from the HTML and add it to a separate stylesheet. A true time saver for those looking for clean HTML.<br /> <strong>&rarr; Visit <a href="http://www.cascader.co/">Cascader</a></strong></p>
<h2>Border Radius.com</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/d705d_css3-tools-3.png" alt="" /><br /> <code>border-radius</code> is one of the most popular CSS3 properties. Those who remember how boring it was to create boxes with rounded corners using images certainly know why. This tool allow you to quickly create a box and get the appropriate CSS3 code.<br /> <strong>&rarr; Visit <a href="http://border-radius.com/">Border Radius.com</a></strong></p>
<h2>Button Maker</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/4e084_css3-tools-4.png" alt="" /><br /> CSS3 allows you to create <a href="http://www.catswhocode.com/blog/top-10-css3-buttons-tutorials">awesome buttons</a>. This tool, created by Chris Coyier, makes CSS3 button design extremely easy: Just pick colors, adjust radius, and get the code, ready to be pasted into your CSS file.<br /> <strong>&rarr; Visit <a href="http://css-tricks.com/examples/ButtonMaker/">Button Maker</a></strong></p>
<h2>CSS3 Generator</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/4e084_css3-tools-5.png" alt="" /><br /> Need help with CSS3 declarations? This very handy generator helps you create declarations for most popular CSS3 properties: @font-face, RGBA, text-shadow, border-radius, and more.<br /> <strong>&rarr; Visit <a href="http://css3generator.com/">CSS3 Generator</a></strong></p>
<h2>Modernizr</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/c4e97_css3-tools-6.png" alt="" /><br /> Modernizr is a small script that detect support for CSS3 and adds classes to the <code>&lt;html&gt;</code> element which allow you to target specific browser functionality in your stylesheet. For example, if the browser does not support the multiple backgrounds functionality, a <code>no-multiplebgs</code> class will be added to the <code>&lt;html&gt;</code> element. then it will be pretty easy for you to fall back.<br /> <strong>&rarr; Visit <a href="http://www.modernizr.com/">Modernizr</a></strong></p>
<h2>HTML5 &#038; CSS3 Support</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/141ca_css3-tools-7.png" alt="" /><br /> Need to know if Internet Explorer 8 supports the <code>text-shadow</code> property? Just have a look to this very useful chart, which reveals CSS3 support for all major browsers. Definitely a page to have in your bookmarks!<br /> <strong>&rarr; Visit <a href="http://www.findmebyip.com/litmus/#target-selector">HTML5 &#038; CSS3 Support</a></strong></p>
<h2>CSS3 Gradient Generator</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/a91d8_css3-tools-8.png" alt="" /><br /> As you can guess, this tool is a gradient generator. Just pick your colors using the picker, preview it in the preview area, and grab your ready-to-be-pasted code. It&#8217;s easy as that!<br /> <strong>&rarr; Visit <a href="http://gradients.glrzad.com/">CSS3 Gradient Generator</a></strong></p>
<h2>CSS3 Please</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/3683d_css3-tools-9.png" alt="" /><br /> CSS3 Please is another very helpful site which allow you to copy and paste most common CSS3 declarations. It also has a preview area so you can live test your declarations.<br /> <strong>&rarr; Visit <a href="http://css3please.com/">CSS3 Please</a></strong></p>
<h2>CSS3 Cheat Sheet</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/3683d_css3-tools-10.png" alt="" /><br /> When coding, cheat sheets are very helpful to quickly remember properties and their syntax. Smashing Magazine has created this CSS3 cheat sheet that you can download and print. A preview version in .gif format is also available <a href="http://media.smashingmagazine.com/wp-content/uploads/images/css3-cheat-sheet/preview.gif">here</a>.<br /> <strong>&rarr; Visit <a href="http://www.smashingmagazine.com/2009/07/13/css-3-cheat-sheet-pdf/">CSS3 Cheat Sheet</a></strong></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/3683d_cuXErQwzHuA" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-tools-to-simplify-css3-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create an adaptable website layout with CSS3 media queries</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/create-an-adaptable-website-layout-with-css3-media-queries/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/create-an-adaptable-website-layout-with-css3-media-queries/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 23:56:26 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[code lt]]></category>
		<category><![CDATA[div id]]></category>
		<category><![CDATA[doctype html]]></category>
		<category><![CDATA[html lang]]></category>
		<category><![CDATA[lorem ipsum]]></category>
		<category><![CDATA[mauris]]></category>
		<category><![CDATA[media queries]]></category>
		<category><![CDATA[meta charset]]></category>
		<category><![CDATA[quot quot]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/create-an-adaptable-website-layout-with-css3-media-queries/</guid>
		<description><![CDATA[Getting started View demo (Horizontally resize your browser to view it in action) Download files Creating the default layout The first step of this tutorial is obviously to create a HTML page. I chose to make a simple HTML5 page with only a header image, a title, and some text. Copy the following code and [...]]]></description>
			<content:encoded><![CDATA[<h2>Getting started</h2>
<ul>
<li><a href="http://www.catswhocode.com/demos/css3-media-queries/">View demo</a> (Horizontally resize your browser to view it in action)</li>
<li><a href="http://www.catswhocode.com/blog/wp-content/uploads/2011/05/css3-media-queries.zip">Download files</a></li>
</ul>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/e7f73_css3-media-queries.jpg" alt="" /></p>
<h2>Creating the default layout</h2>
<p>The first step of this tutorial is obviously to create a HTML page. I chose to make a simple HTML5 page with only a header image, a title, and some text. Copy the following code and paste it into a file named <code>index.html</code>.</p>
<pre>
&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;

&lt;head&gt;
	&lt;meta charset=&quot;utf-8&quot;&gt;
   	&lt;title&gt;Cats Who Code demo&lt;/title&gt;
	&lt;link href=&quot;style.css&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot; media=&quot;screen&quot;&gt;
	&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width; initial-scale=1.0; maximum-scale=1.0;&quot;&gt;
&lt;/head&gt;

&lt;body&gt;
	&lt;div id=&quot;container&quot;&gt;
		&lt;header class=&quot;ma-class-en-css&quot;&gt;
			&lt;h1 id =&quot;logo&quot;&gt;&lt;a href=&quot;#&quot;&gt;Cats Who Code&lt;/a&gt;&lt;/h1&gt;
		&lt;/header&gt;

		&lt;div id=&quot;content&quot;&gt;
       		&lt;h2&gt;Paris, France&lt;/h2&gt;
        	&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce a ligula massa. Donec consequat, risus nec viverra condimentum, elit velit dignissim dui, id congue sapien leo tincidunt est. Mauris consectetur tempus lorem id aliquet. Proin eu faucibus massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In magna ligula, ornare sed posuere faucibus, consequat ac lacus. Fusce sodales fermentum nibh, a imperdiet nisi bibendum eget. Donec gravida iaculis sapien eu consectetur. Curabitur id augue augue. Nam mauris urna, suscipit eget faucibus sit amet, mollis vitae felis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Mauris ipsum lectus, imperdiet id aliquam nec, vulputate vitae mauris. Integer gravida, neque eu placerat egestas, urna metus bibendum nisl, quis congue felis velit id diam. Quisque non tortor at turpis facilisis placerat quis sed felis. Ut eget ipsum dolor, id lacinia leo. Vivamus vitae blandit libero. Integer ultricies gravida leo quis lobortis. Morbi ultrices risus vulputate magna dignissim sed ultricies arcu tristique. Sed non facilisis sapien.&lt;/p&gt;

			&lt;p&gt;Integer faucibus, augue vitae vulputate sodales, tellus tellus vulputate tortor, in iaculis ipsum orci vitae libero. Vestibulum laoreet accumsan erat vel pretium. Ut turpis elit, ultricies id accumsan non, condimentum feugiat neque. Nam ut erat urna, a porta augue. Donec vel porttitor magna. Cras eget tortor eget ante malesuada sodales sed a leo. Fusce sit amet cursus sem. Nulla aliquet accumsan ante sit amet condimentum. Morbi varius porta sapien nec iaculis. In gravida velit at nulla imperdiet varius.&lt;/p&gt;
        &lt;/div&gt;&lt;!-- #content --&gt;

		&lt;footer&gt;A demo by &lt;a href=&quot;http://www.catswhocode.com&quot;&gt;CatsWhoCode&lt;/a&gt;&lt;/footer&gt;
	&lt;/div&gt;&lt;!-- #container --&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Once done, we have to add a stylesheet to our <code>index.html</code> page. The following code is the basic styling for the page. Paste it into a file named <code>style.css</code>.</p>
<pre>
*{
	/* On a production site, use a real reset instead of this! */
	margin:0;
	padding:0;
}            

body{
	background:#f5f5f5;
	font-family:&quot;Lucida Grande&quot;, Arial;
	font-size:13px;
	line-height:21px;
	color:#444;
}     

p{
	margin:15px 0;
}              

h2{
	margin-top:20px;
}

#container{
	background:#fff;
	border-left:1px #ddd solid;
	border-right:1px #ddd solid;
	border-bottom:1px #ddd solid;
	width:600px;
	margin:0 auto;
}  

header h1#logo a{
	text-indent:-9999px;
	display:block;
	width:600px;
	height:82px;
	background:url(image-med.jpg) no-repeat 0 0;
}             

#content{
	width:95%;
	margin:0 auto;
}

footer{
	text-align:center;
	width:100%;
	display:block;
	font-size:11px;
}
</pre>
<p>Right now, if you look to your <code>index.html</code> page through your web browser, you&#8217;ll see something like the screenshot below. Nothing spectular, right? Keep reading, we&#8217;re going to dive into the interesting part.</p>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/e7f73_css3-adaptable-layout-1.png" alt="" /></p>
<h2>Using CSS3 media queries to make our layout fit in all screen resolutions</h2>
<p>If you had a look to your <code>index.html</code> page with a screen resolution bigger than 800*600, you might find the layout is really small. So, what about allowing large screens to display a bigger version, while still using the small version for people with lower resolutions?</p>
<p>This is what CSS3 media queries can do for you. Open your <code>style.css</code> file and paste the code below at the end of the file:</p>
<pre>
@media screen and (min-width:1200px){
	#container{
		width:1100px;
	}  

	header h1#logo a{
		width:1100px;
		height:150px;
		background:url(image.jpg) no-repeat 0 0;
	}                          

}
</pre>
<p>Now, have a look at <code>index.html</code> again: The layout is indeed bigger. Horizontally resize the window size&#8230; The site switches back to the small layout. How great is that?</p>
<p>As you can see, there&#8217;s nothing complicated at all in implementing this technique. <code>@media screen</code> tells the browser this applies only for screens, because we don&#8217;t want to resize anything for print. And <code>and (min-width:1200px)</code> specifies that the screen must have a 1200px minimum width. If these requirements are met, then the code within the parenthesis is taken into consideration by the browser, and redefines previous styles.</p>
<p>Now that we created a bigger version for bigger screens, what about a very small version for mobiles? Paste this code into <code>style.css</code> and you&#8217;re done.</p>
<pre>
@media screen and (max-width:767px){
	#container{
		width:320px;
	} 

	header h1#logo a{
		width:320px;
		height:44px;
		background:url(image-small.jpg) no-repeat 0 0;
	}                           

}
</pre>
<h2>Dealing with images</h2>
<p>Images always play an important part of a website. So, let&#8217;s add an image to our website layout. Re-open <code>index.html</code> and insert the following code just before the first closing <code>&lt;/p&gt;</code></p>
<pre>
&lt;img src="notre-dame.jpg" alt="Photo by Wlappe"&gt;
</pre>
<p>If you have a look to <code>index.html</code> with a big screen, no problem. But if you resize the window horizontally&#8230;ouch.</p>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/b5ecc_css3-adaptable-layout-2.png" alt="" /></p>
<p>The solution to that problem is quite simple: As we resize the website layout, we have to resize images as well. The <code>max-width</code> CSS property is here to help.</p>
<p>Insert the following on your <code>style.css</code> file:</p>
<pre>
img {
	max-width:570px;
	margin:10px 0;
}
</pre>
<p>A default image size is now defined. Now we can setup sizes for big screens as well as mobile devices:</p>
<pre>
@media screen and (min-width:1200px){
	img {
		max-width:1000px;
	}
}

@media screen and (max-width:767px){
	img {
    	max-width:305px;
	}
}
</pre>
<p>Now, resize your browser: Images are resized with the layout!</p>
<h2>Limitations</h2>
<p>Guess what? Internet Explorer (excepted the newly released IE9) doesn&#8217;t know anything about the CSS <code>@media</code> property. Which means that even on a big screen, IE users will see the default layout.</p>
<p>Hope you enjoyed this tutorial. Have a great day!</p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/04736_BpKFMPOK6UY" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/create-an-adaptable-website-layout-with-css3-media-queries/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to create an online radio using jQuery and jPlayer</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-an-online-radio-using-jquery-and-jplayer/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-an-online-radio-using-jquery-and-jplayer/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 23:56:00 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[auto increment]]></category>
		<category><![CDATA[demo html]]></category>
		<category><![CDATA[html xmlns]]></category>
		<category><![CDATA[key song]]></category>
		<category><![CDATA[mp3 one]]></category>
		<category><![CDATA[song id]]></category>
		<category><![CDATA[sql code]]></category>
		<category><![CDATA[table songs]]></category>
		<category><![CDATA[transitional dtd]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-an-online-radio-using-jquery-and-jplayer/</guid>
		<description><![CDATA[Getting started View demo Read jPlayer documentation Download files Creating the database First, create a new SQL database. Let&#8217;s call it radio. Once done, we have to create a table. We only need 4 fields: An id, the mp3 url, the artist name and the song title. Here is the SQL code to use in [...]]]></description>
			<content:encoded><![CDATA[<h2>Getting started</h2>
<ul>
<li><a href="http://phpsnippets.info/test/demo.htm">View demo</a></li>
<li><a href="http://jplayer.org/latest/developer-guide">Read jPlayer documentation</a></li>
<li><a href="http://www.catswhocode.com/blog/wp-content/uploads/2011/05/cwc-radio-player.zip">Download files</a></li>
</ul>
<h2>Creating the database</h2>
<p>First, create a new SQL database. Let&#8217;s call it <code>radio</code>. Once done, we have to create a table. We only need 4 fields: An id, the mp3 url, the artist name and the song title. Here is the SQL code to use in order to create the table named <code>songs</code>:</p>
<pre>
CREATE TABLE `songs` (
  `song_id` int(11) NOT NULL AUTO_INCREMENT,
  `url` varchar(500) NOT NULL,
  `artist` varchar(250) NOT NULL,
  `title` varchar(250) NOT NULL,
  PRIMARY KEY (`song_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
</pre>
<p>We now have a database and a table to store basic information about songs we&#8217;re going to play on our radio. Now we have to populate the table. Choose some mp3 files and insert the following statement into your database:</p>
<pre>
INSERT INTO `songs` (`song_id`, `url`, `artist`, `title`) VALUES ('', 'http://mysongs.com/songurl.mp3', 'Artist name', 'Song name');
INSERT INTO `songs` (`song_id`, `url`, `artist`, `title`) VALUES ('', 'http://mysongs.com/anothersongurl.mp3', 'Another artist', 'Another song');
INSERT INTO `songs` (`song_id`, `url`, `artist`, `title`) VALUES ('', 'http://mysongs.com/onemoresongurl.mp3', 'One more artist', 'One more song');
</pre>
<p>Right now, the database is ready.</p>
<h2>Creating the HTML</h2>
<p>Of course, we have to create a HTML page. First, grab your copy of <a href="http://jplayer.org/">jPlayer</a>, the jQuery plugin we&#8217;re going to use to create the online radio. Unzip the file, then upload the <code>js/</code> and <code>skin/</code> to your server.</p>
<p>Then, create a file named <code>demo.html</code> on your server and insert the following code into it:</p>
<pre>
&lt;!DOCTYPE html PUBLIC &#039;-//W3C//DTD XHTML 1.0 Transitional//EN&#039; &#039;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#039;&gt;
&lt;html xmlns=&#039;http://www.w3.org/1999/xhtml&#039; lang=&#039;en&#039; xml:lang=&#039;en&#039;&gt;
&lt;head&gt;
	&lt;title&gt;Online radio using jQuery&lt;/title&gt;
	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot; /&gt;

	&lt;link href=&quot;skin/jplayer.blue.monday.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;

	&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js&quot;&gt;&lt;/script&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery.jplayer.min.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
	&lt;div id=&quot;jquery_jplayer_1&quot; class=&quot;jp-jplayer&quot;&gt;&lt;/div&gt;
		&lt;div class=&quot;jp-audio&quot;&gt;
			&lt;div class=&quot;jp-type-single&quot;&gt;
		    	&lt;div id=&quot;jp_interface_1&quot; class=&quot;jp-interface&quot;&gt;
					&lt;ul class=&quot;jp-controls&quot;&gt;
						&lt;li&gt;&lt;a href=&quot;#&quot; class=&quot;jp-play&quot; tabindex=&quot;1&quot;&gt;play&lt;/a&gt;&lt;/li&gt;
						&lt;li&gt;&lt;a href=&quot;#&quot; class=&quot;jp-pause&quot; tabindex=&quot;1&quot;&gt;pause&lt;/a&gt;&lt;/li&gt;
						&lt;li&gt;&lt;a href=&quot;#&quot; class=&quot;jp-stop&quot; tabindex=&quot;1&quot;&gt;stop&lt;/a&gt;&lt;/li&gt;
						&lt;li&gt;&lt;a href=&quot;#&quot; class=&quot;jp-mute&quot; tabindex=&quot;1&quot;&gt;mute&lt;/a&gt;&lt;/li&gt;
						&lt;li&gt;&lt;a href=&quot;#&quot; class=&quot;jp-unmute&quot; tabindex=&quot;1&quot;&gt;unmute&lt;/a&gt;&lt;/li&gt;
					&lt;/ul&gt;

					&lt;div class=&quot;jp-progress&quot;&gt;
						&lt;div class=&quot;jp-seek-bar&quot;&gt;
							&lt;div class=&quot;jp-play-bar&quot;&gt;&lt;/div&gt;
						&lt;/div&gt;
					&lt;/div&gt;

					&lt;div class=&quot;jp-volume-bar&quot;&gt;
						&lt;div class=&quot;jp-volume-bar-value&quot;&gt;&lt;/div&gt;
					&lt;/div&gt;

					&lt;div class=&quot;jp-current-time&quot;&gt;&lt;/div&gt;
					&lt;div class=&quot;jp-duration&quot;&gt;&lt;/div&gt;
				&lt;/div&gt;

				&lt;div id=&quot;jp_playlist_1&quot; class=&quot;jp-playlist&quot;&gt;
					&lt;ul&gt;
						&lt;li&gt;&lt;strong id=&quot;artist&quot;&gt;Artist&lt;/strong&gt; - &lt;span id=&quot;songname&quot;&gt;Song name&lt;/span&gt;&lt;/li&gt;
					&lt;/ul&gt;
				&lt;/div&gt;
			&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/body&gt;

&lt;/html&gt;
</pre>
<p>This code has been taken from jPlayer&#8217;s demos. It is a simple html code that insert the necessary JavaScript files (jQuery + the jPlayer plugin) as well as the CSS and html used to display the music player. Right now, the player do not display correctly: We still have to use some jQuery to animate it. We&#8217;ll see that in a minute.</p>
<h2>Getting files from the database</h2>
<p>Now, we have to create a PHP file that will get a random song from the database, and display the file url as well as the artist and song name so we can grab it using Ajax. First, get your copy of <a href="http://justinvincent.com/ezsql">ezSQL</a> that I chose to use to manage my database queries. (Full ezSQl tutorial available <a href="http://www.catswhocode.com/blog/php-fast-and-easy-sql-queries-using-ezsql">here</a>) Unzip the files and upload <code>ez_sql_core.php</code> and <code>ez_sql_mysql.php</code> to the server.</p>
<p>Once done, create a file named <code>getsong.php</code> on the server. Paste the following code in it:</p>
<pre>
&lt;?php

if(!empty($_SERVER[&#039;HTTP_X_REQUESTED_WITH&#039;]) &amp;&amp; strtolower($_SERVER[&#039;HTTP_X_REQUESTED_WITH&#039;]) == &#039;xmlhttprequest&#039;){ 

	include_once &quot;ez_sql_core.php&quot;;
	include_once &quot;ez_sql_mysql.php&quot;;
	$db = new ezSQL_mysql(&#039;db_user&#039;,&#039;db_password&#039;,&#039;db_name&#039;,&#039;db_host&#039;); 

	$song = $db-&gt;get_row(&quot;SELECT * FROM songs ORDER BY RAND() LIMIT 1&quot;);

	$artist = $song-&gt;artist;
	$songname = $song-&gt;title;
	$url = $song-&gt;url;
	$separator = &#039;|&#039;;
	echo $url.$separator.$artist.$separator.$songname;
} 

?&gt;
</pre>
<p>Nothing complicated: I&#8217;ve included the ezSQL files needed, created a connection to the database, then requested one row from the <code>songs</code> table. The 3 values (File url, artist, and song name) are displayed on screen, separated by a pipe.</p>
<p>The conditional statement is used to detect Ajax requests and prevent people from being able to display songs url by simply typing <code>http://www.yousite.com/getsong.php</code> on their browser address bar.</p>
<h2>Making it work</h2>
<p>Alright, we&#8217;re almost done. What we need now is to use some jQuery to request a song using Ajax and our <code>getsong.php</code> file. Then, we&#8217;ll use jPlayer to play it.</p>
<p>Open your <code>demo.html</code> and paste the following after line 10:</p>
<pre>
&lt;script type=&quot;text/javascript&quot;&gt;
//&lt;![CDATA[

$(document).ready(function(){
	$(&quot;#jquery_jplayer_1&quot;).jPlayer({
		ready: function () {
			var data = $.ajax({
			  url: &quot;getsong.php&quot;,
			  async: false
			 }).responseText;

		    var string = data.split(&#039;|&#039;);
			$(this).jPlayer(&quot;setMedia&quot;, {
				mp3: string[0]
			}).jPlayer(&quot;play&quot;);

			$(&#039;#artist&#039;).html(string[1]);
			$(&#039;#songname&#039;).html(string[2]);
		},
		ended: function (event) {
			var data = $.ajax({
			  url: &quot;getsong.php&quot;,
			  async: false
			 }).responseText;

		    var string = data.split(&#039;|&#039;);
			$(this).jPlayer(&quot;setMedia&quot;, {
				mp3: string[0]
			}).jPlayer(&quot;play&quot;);

			$(&#039;#artist&#039;).html(string[1]);
			$(&#039;#songname&#039;).html(string[2]);
	    },
		swfPath: &quot;js&quot;,
		supplied: &quot;mp3&quot;
	});
});
//]]&gt;
&lt;/script&gt;
</pre>
<p>Now, if you save the file and point your browser to http://www.yoursite.com/demo.html, your radio should work: It gets a song from the database and play it. When the song&#8217;s over, another one is automatically selected.</p>
<p>There&#8217;s probably better ways to write this code (It has a lot of redundant code, which is always a bad practice) so don&#8217;t hesitate to write a comment if you have a better version to suggest.</p>
<h2>How to enhance the script</h2>
<p>While we have a working radio, it is very basic and can be enhanced: For example, we should exclude song already played (using songs ids stored in the database) or even better, create playlists. I haven&#8217;t worked on it yet, but if you are interested let me know in a comment and I might write a tutorial about it.</p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/48787_ispvjqg83k0" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-an-online-radio-using-jquery-and-jplayer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
<enclosure url="http://mysongs.com/anothersongurl.mp3" length="1252" type="audio/mpeg" />
<enclosure url="http://mysongs.com/songurl.mp3" length="1252" type="audio/mpeg" />
<enclosure url="http://mysongs.com/onemoresongurl.mp3" length="1252" type="audio/mpeg" />
		</item>
		<item>
		<title>Top 10 CSS 3 forms tutorials</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/top-10-css-3-forms-tutorials/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/top-10-css-3-forms-tutorials/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 23:55:34 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[british web]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[elements]]></category>
		<category><![CDATA[nothing fancy]]></category>
		<category><![CDATA[search forms]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[spinners]]></category>
		<category><![CDATA[spooner]]></category>
		<category><![CDATA[web developer]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/top-10-css-3-forms-tutorials/</guid>
		<description><![CDATA[HTML5 &#038; CSS3 form HTML5 introduced useful new form elements as such as sliders, numeric spinners and date pickers. This tutorial will show you how to create a form with HTML5, and make it look really cool with CSS3. A great way to get started in both CSS3 and HTML5. &#187; View tutorial CSS3 form [...]]]></description>
			<content:encoded><![CDATA[<h2>HTML5 &#038; CSS3 form</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/670eb_css3-form-1.jpg" alt="" /><br /> HTML5 introduced useful new form elements as such as sliders, numeric spinners and date pickers. This tutorial will show you how to create a form with HTML5, and make it look really cool with CSS3. A great way to get started in both CSS3 and HTML5.<br /> <strong>&raquo; <a href="http://net.tutsplus.com/tutorials/html-css-techniques/how-to-build-cross-browser-html5-forms/">View tutorial</a></strong></p>
<h2>CSS3 form without images and JavaScript</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/670eb_css3-form-2.jpg" alt="" /><br /> This tutorial is in French, but the result looks so good that I simply shouldn&#8217;t include it on that list. For those who can&#8217;t understand French, just <a href="http://bbxdesign.com/wp-content/uploads/html/formulaire-css3.html">get the source code</a> and have fun with it.<br /> <strong>&raquo; <a href="http://bbxdesign.com/2010/03/24/tutoriel-formulaire-css3-sans-image-sans-javascript/">View tutorial</a></strong></p>
<h2>Stylish Contact Form with HTML5 &#038; CSS3</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/670eb_css3-form-3.jpg" alt="" /><br /> I really love what British web developer Chris Spooner creates. This time, he&#8217;s back with a quality tutorial about creating a form and using CSS3 to style it. The result is, as you can see above, really cool.<br /> <strong>&raquo; <a href="http://line25.com/tutorials/create-a-stylish-contact-form-with-html5-css3">View tutorial</a></strong></p>
<h2>Beautiful CSS3 Search Form</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/aa307_css3-form-4.jpg" alt="" /><br /> Most search forms (Including the one I use on this site!) looks boring. Using a little CSS3, you can turn the old and boring form into something definitely modern and cool. A must read tutorial.<br /> <strong>&raquo; <a href="http://webdesignerwall.com/tutorials/beautiful-css3-search-form">View tutorial</a></strong></p>
<h2>Prettier Web Form with CSS 3</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/aa307_css3-form.jpg" alt="" /><br /> This pretty simple tutorial will show you how you can create a form using some basic CSS3 properties, such as <code>box-shadow</code>.<br /> <strong>&raquo; <a href="http://net.tutsplus.com/tutorials/html-css-techniques/design-a-prettier-web-form-with-css-3/">View tutorial</a></strong></p>
<h2>Slick CSS3 Login Form</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/aa307_css3-form-6.jpg" alt="" /><br /> Once again, a simple tutorial to create a simple form using CSS3 but absolutely no images.<br /> <strong>&raquo; <a href="http://www.threestyles.com/tutorials/css3-login-form-tutorial/">View tutorial</a></strong></p>
<h2>Glowform: Amazing CSS3 form</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/aa307_css3-form-7.png" alt="" /><br /> Wow! This form looks really great, isn&#8217;t it? This form do not use any images, only CSS3. I urge you to read this tutorial and the form source code, because you&#8217;ll learn lots of great techniques about creating killer forms without using images.<br /> <strong>&raquo; <a href="http://kaylarose.github.com/Glowform/">View tutorial</a></strong></p>
<h2>Clean and Stylish CSS3 Form</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/26152_css3-form-8.png" alt="" /><br /> This form is simple, clean and stylish. Nothing fancy but techniques you&#8217;ll may use on most websites you&#8217;ll make.<br /> <strong>&raquo; <a href="http://gazpo.com/2011/02/form/">View tutorial</a></strong></p>
<h2>Signup form with CSS3 and jQuery</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/26152_css3-form-9.jpg" alt="" /><br /> jQuery is definitely a great tool to make forms more usable. This tutorial will show you how to create a good looking form using CSS3, and how to make it more user-friendly with some jQuery.<br /> <strong>&raquo; <a href="http://webexpedition18.com/articles/how-to-create-a-multi-step-signup-form-with-css3-and-jquery/">View tutorial</a></strong></p>
<h2>jQuery &#038; CSS3 Drop-down menu with integrated forms</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/f3fd9_css3-form-10.png" alt="" /><br /> At last but not least, here is a tutorial about how to create a CSS3/jQuery dropdown menu with integrated forms. No doubt, your clients will love it!<br /> <strong>&raquo; <a href="http://addyosmani.com/blog/formbox/">View tutorial</a></strong></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/f3fd9_n2iR47u4Pgw" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/top-10-css-3-forms-tutorials/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>10 super useful PHP snippets</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-super-useful-php-snippets/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-super-useful-php-snippets/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 23:55:02 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[acos]]></category>
		<category><![CDATA[cached content]]></category>
		<category><![CDATA[caching system]]></category>
		<category><![CDATA[code snippet]]></category>
		<category><![CDATA[fwrite]]></category>
		<category><![CDATA[handy function]]></category>
		<category><![CDATA[latitudes and longitudes]]></category>
		<category><![CDATA[miles kilometers]]></category>
		<category><![CDATA[php snippets]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-super-useful-php-snippets/</guid>
		<description><![CDATA[Super simple page caching When your project isn&#8217;t based on a CMS or framework, it can be a good idea to implement a simple caching system on your pages. The following code snippet is very simple, but works well for small websites. &#60;?php // define the path and name of cached file $cachefile = &#039;cached-files/&#039;.date(&#039;M-d-Y&#039;).&#039;.php&#039;; [...]]]></description>
			<content:encoded><![CDATA[<h2>Super simple page caching</h2>
<p>When your project isn&#8217;t based on a CMS or framework, it can be a good idea to implement a simple caching system on your pages. The following code snippet is very simple, but works well for small websites.</p>
<pre>
&lt;?php
    // define the path and name of cached file
    $cachefile = &#039;cached-files/&#039;.date(&#039;M-d-Y&#039;).&#039;.php&#039;;
    // define how long we want to keep the file in seconds. I set mine to 5 hours.
    $cachetime = 18000;
    // Check if the cached file is still fresh. If it is, serve it up and exit.
    if (file_exists($cachefile) &amp;&amp; time() - $cachetime &lt; filemtime($cachefile)) {
    include($cachefile);
        exit;
    }
    // if there is either no file OR the file to too old, render the page and capture the HTML.
    ob_start();
?&gt;
    &lt;html&gt;
        output all your html here.
    &lt;/html&gt;
&lt;?php
    // We&#039;re done! Save the cached content to a file
    $fp = fopen($cachefile, &#039;w&#039;);
    fwrite($fp, ob_get_contents());
    fclose($fp);
    // finally send browser output
    ob_end_flush();
?&gt;
</pre>
<p><strong>&raquo; <a href="http://wesbos.com/simple-php-page-caching-technique/">Credit: Wes Bos</a></strong></p>
<h2>Calculate distances in PHP</h2>
<p>Here is a very handy function, which calculate the distance from a point A to a point B, using latitudes and longitudes. The function can return the distance in miles, kilometers, or nautical miles.</p>
<pre>
function distance($lat1, $lon1, $lat2, $lon2, $unit) { 

  $theta = $lon1 - $lon2;
  $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) +  cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
  $dist = acos($dist);
  $dist = rad2deg($dist);
  $miles = $dist * 60 * 1.1515;
  $unit = strtoupper($unit);

  if ($unit == &quot;K&quot;) {
    return ($miles * 1.609344);
  } else if ($unit == &quot;N&quot;) {
      return ($miles * 0.8684);
    } else {
        return $miles;
      }
}
</pre>
<p>Usage:</p>
<pre>echo distance(32.9697, -96.80322, 29.46786, -98.53506, "k")." kilometers";</pre>
<p><strong>&raquo; <a href="http://www.phpsnippets.info/calculate-distances-in-php">Credits: PHP Snippets.info</a></strong></p>
<h2>Convert seconds to time (years, months, days, hours&#8230;)</h2>
<p>This useful function will convert a time in seconds to a time in years, months, weeks, days, and so on.</p>
<pre>
function Sec2Time($time){
  if(is_numeric($time)){
    $value = array(
      &quot;years&quot; =&gt; 0, &quot;days&quot; =&gt; 0, &quot;hours&quot; =&gt; 0,
      &quot;minutes&quot; =&gt; 0, &quot;seconds&quot; =&gt; 0,
    );
    if($time &gt;= 31556926){
      $value[&quot;years&quot;] = floor($time/31556926);
      $time = ($time%31556926);
    }
    if($time &gt;= 86400){
      $value[&quot;days&quot;] = floor($time/86400);
      $time = ($time%86400);
    }
    if($time &gt;= 3600){
      $value[&quot;hours&quot;] = floor($time/3600);
      $time = ($time%3600);
    }
    if($time &gt;= 60){
      $value[&quot;minutes&quot;] = floor($time/60);
      $time = ($time%60);
    }
    $value[&quot;seconds&quot;] = floor($time);
    return (array) $value;
  }else{
    return (bool) FALSE;
  }
}
</pre>
<p><strong>&raquo; <a href="http://ckorp.net/sec2time.php">Credits</a></strong></p>
<h2>Force file download</h2>
<p>Some files, such as mp3, are generally played throught the client browser. If you prefer forcing download of such files, this is not a problem: The following code snippet will do that job properly.</p>
<pre>
function downloadFile($file){
        $file_name = $file;
        $mime = 'application/force-download';
	header('Pragma: public'); 	// required
	header('Expires: 0');		// no cache
	header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
	header('Cache-Control: private',false);
	header('Content-Type: '.$mime);
	header('Content-Disposition: attachment; filename="'.basename($file_name).'"');
	header('Content-Transfer-Encoding: binary');
	header('Connection: close');
	readfile($file_name);		// push it out
	exit();
}
</pre>
<p><strong>&raquo; <a href="http://www.tecnocrazia.com/">Credit: Alessio Delmonti</a></strong></p>
<h2>Get current weather using Google API</h2>
<p>Want to know today&#8217;s weather? This snippet will let you know, in only 3 lines of code. The only thing you have to do is to replace ADDRESS by the desired adress, on line 1.</p>
<pre>
$xml = simplexml_load_file(&#039;http://www.google.com/ig/api?weather=ADDRESS&#039;);
  $information = $xml-&gt;xpath(&quot;/xml_api_reply/weather/current_conditions/condition&quot;);
  echo $information[0]-&gt;attributes();
</pre>
<p><strong>&raquo; <a href="http://ortanotes.tumblr.com/post/200469319/current-weather-in-3-lines-of-php">Credit: Ortanotes</a></strong></p>
<h2>Basic PHP whois</h2>
<p>Whois services are extremely useful to get basic information about a domain name: owner, creation date, registrar, etc. Using PHP and the <code>whois</code> unix command, it is extremely easy to create a basic whois PHP function. Please note that the <code>whois</code> unix command must be installed on your server for this code to work.</p>
<pre>
$domains = array(&#039;home.pl&#039;, &#039;w3c.org&#039;);

function creation_date($domain) {
    $lines = explode(&quot;\n&quot;, `whois $domain`);
    foreach($lines as $line) {
        if(strpos(strtolower($line), &#039;created&#039;) !== false) {
            return $line;
        }
    }

    return false;
}

foreach($domains as $d) {
    echo creation_date($d) . &quot;\n&quot;;
}
</pre>
<p><strong>&raquo; <a href="http://snipplr.com/view.php?codeview&amp;id=48040">Credits: Snipplr</a></strong></p>
<h2>Get latitude and longitude from an adress</h2>
<p>With the popularity of the Google Maps API, developers often needs to get the latitude and longitude of a particular place. This very useful function takes an adress as a parameter, and will return an array of data containing both latitude and longitude.</p>
<pre>
function getLatLong($address){
	if (!is_string($address))die(&quot;All Addresses must be passed as a string&quot;);
	$_url = sprintf(&#039;http://maps.google.com/maps?output=js&amp;q=%s&#039;,rawurlencode($address));
	$_result = false;
	if($_result = file_get_contents($_url)) {
		if(strpos($_result,&#039;errortips&#039;) &gt; 1 || strpos($_result,&#039;Did you mean:&#039;) !== false) return false;
		preg_match(&#039;!center:\s*{lat:\s*(-?\d+\.\d+),lng:\s*(-?\d+\.\d+)}!U&#039;, $_result, $_match);
		$_coords[&#039;lat&#039;] = $_match[1];
		$_coords[&#039;long&#039;] = $_match[2];
	}
	return $_coords;
}
</pre>
<p><strong>&raquo; <a href="http://snipplr.com/view.php?codeview&amp;id=47806">Credits: Snipplr</a></strong></p>
<h2>Get domain favicon using PHP and Google</h2>
<p>These days, many websites or webapps are using favicons from other websites. Displaying a favicon on your own site is pretty easy using Google and some PHP.</p>
<pre>
function get_favicon($url){
  $url = str_replace(&quot;http://&quot;,&#039;&#039;,$url);
  return &quot;http://www.google.com/s2/favicons?domain=&quot;.$url;
}
</pre>
<p><strong>&raquo; <a href="http://snipplr.com/view.php?codeview&amp;id=45928">Credits: Snipplr</a></strong></p>
<h2>Calculate Paypal fees</h2>
<p>Ah, Paypal fees. Every person who ever used the popular online payment service had to pay their fees. So what about a PHP function to easily calculate the fee for a specific amount?</p>
<pre>
function paypalFees($sub_total, $round_fee) {

	// Set Fee Rate Variables
	$fee_percent = &#039;3.4&#039;; // Paypal&#039;s percentage rate per transaction (3.4% in UK)
	$fee_cash    = &#039;0.20&#039;; // Paypal&#039;s set cash amount per transaction (&#163;0.20 in UK)

	// Calculate Fees
	$paypal_fee = ((($sub_total / 100) * $fee_percent) + $fee_cash);

	if ($round_fee == true) {
		$paypal_fee = ceil($paypal_fee);
	}

	// Calculate Grand Total
	$grand_total = ($sub_total + $paypal_fee);

	// Tidy Up Numbers
	$sub_total   = number_format($sub_total, 2, &#039;.&#039;, &#039;,&#039;);
	$paypal_fee  = number_format($paypal_fee, 2, &#039;.&#039;, &#039;,&#039;);
	$grand_total = number_format($grand_total, 2, &#039;.&#039;, &#039;,&#039;);

	// Return Array
	return array(&#039;grand_total&#039;=&gt;$grand_total, &#039;paypal_fee&#039;=&gt;$paypal_fee, &#039;sub_total&#039;=&gt;$sub_total);
}
</pre>
<p><strong>&raquo; <a href="http://snipplr.com/view.php?codeview&amp;id=44373">Credits: Snipplr</a></strong></p>
<p><em>(Last snippet have been removed due to an error, sorry)</em></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/0df26_JrGX1_-mHds" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-super-useful-php-snippets/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Easily create multilingual sites with WordPress</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/easily-create-multilingual-sites-with-wordpress/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/easily-create-multilingual-sites-with-wordpress/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 09:31:11 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[code lt]]></category>
		<category><![CDATA[dashboard]]></category>
		<category><![CDATA[div class]]></category>
		<category><![CDATA[h1]]></category>
		<category><![CDATA[localization]]></category>
		<category><![CDATA[translation]]></category>
		<category><![CDATA[Translations]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/easily-create-multilingual-sites-with-wordpress/</guid>
		<description><![CDATA[1 &#8211; Localize theme strings Before installing a plugin on your blog, the first thing to do is to localize theme strings. PHP and the Gettext tool (which allow easy string translation) have two functions: _e() and __(). The only difference between _e() and __() is that _e() echo a string while __() is used [...]]]></description>
			<content:encoded><![CDATA[<h2>1 &#8211; Localize theme strings</h2>
<p>Before installing a plugin on your blog, the first thing to do is to localize theme strings. PHP and the Gettext tool (which allow easy string translation) have two functions: <code>_e()</code> and <code>__()</code>.</p>
<p>The only difference between <code>_e()</code> and <code>__()</code> is that <code>_e()</code> echo a string while <code>__()</code> is used to assign a string to a variable.</p>
<p>Let&#8217;s say your theme have the following code:</p>
<pre>
&lt;div class=&quot;content&quot;&gt;
    &lt;h1&gt;Welcome to my site!&lt;/h1&gt;
    &lt;p&gt;I hope you&#039;ll like it.&lt;/p&gt;
&lt;/div&gt;&lt;!-- #content --&gt;
</pre>
<p>What you have to do is to wrap all strings into the <code>_e()</code> or <code>__()</code> functions, as shown in the example below:</p>
<pre>
&lt;div class=&quot;content&quot;&gt;
    &lt;h1&gt;&lt;?php _e(&quot;Welcome to my site!&quot;); ?&gt;&lt;/h1&gt;
    &lt;p&gt;&lt;?php _e(&quot;I hope you&#039;ll like it.&quot;); ?&gt;&lt;/p&gt;
&lt;/div&gt;&lt;!-- #content --&gt;
</pre>
<p>Once done, your string will be recognized by the WPML plugin (we&#8217;re going to install it) as translatable strings.</p>
<h2>2 &#8211; Install and configure the WPML plugin</h2>
<p>Now that your theme is fully localized, the next step is to install the WPML plugin, which will make our blog multilingual. Install the plugin using your WordPress dashboard, or get it <a href="http://wordpress.org/extend/plugins/sitepress-multilingual-cms/">here</a>. Activate the plugin, then you&#8217;ll see a &#8220;WPML&#8221; link on your WordPress dashboard. Click on it and add at least one language.</p>
<h2>3 &#8211; Translate theme strings</h2>
<p>Once done, you now have to translate your theme strings in French. To do so, click on the &#8220;Theme and plugins localization&#8221; link located under the &#8220;WPML&#8221; tab. On the &#8220;Theme and plugins localization&#8221; page (See screenshot below) choose the <strong>Translate the theme by WPML</strong> option, so you&#8217;ll be able to directly provide translations in your WordPress dashboard. Though, if your prefer using a .mo file, the WPML plugin allows it as well, so feel free to choose your favorite option.</p>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/ff48e_wpml.png" alt="" /></p>
<h2>4 &#8211; Translate site content</h2>
<p>Now, you have to translate your site/blog content. WPML provide an easy way to do it: Simply edit one of your posts or pages and have a look at the right side of the screen: you&#8217;ll see a box where you can create a translation for each of your posts and pages.</p>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/7c24f_wpml2.png" alt="" /></p>
<p>Translating your site content can take a while if your site have lots of pages, but thanks to the WPML plugin it is pretty easy to do.</p>
<h2>5 &#8211; Translating your site menu</h2>
<p>Right now, almost all your site is fully multilingual. Though, you still have to translate your navigation menu. To do so, simply go to &#8220;Appearance&#8221;, &#8220;Menus&#8221; and select your current menu. As you can see on the screenshot below, WPML has added some new options to allow you to create a new menu per language. How cool is that?</p>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/7c24f_wpml3.png" alt="" /></p>
<p>Right now, you should have a fully multilingual website. Hope you enjoyed this tutorial!</p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/easily-create-multilingual-sites-with-wordpress">Easily create multilingual sites with WordPress</a></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/7c24f_M8lP0T6lZXQ" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/easily-create-multilingual-sites-with-wordpress/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>8 awesome new jQuery plugins to have in your toolbox</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-awesome-new-jquery-plugins-to-have-in-your-toolbox-2/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-awesome-new-jquery-plugins-to-have-in-your-toolbox-2/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 20:42:29 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[alternative solution]]></category>
		<category><![CDATA[cat man]]></category>
		<category><![CDATA[going mobile]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[nivo]]></category>
		<category><![CDATA[radio buttons]]></category>
		<category><![CDATA[smooth transitions]]></category>
		<category><![CDATA[visual aspect]]></category>
		<category><![CDATA[web developers]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-awesome-new-jquery-plugins-to-have-in-your-toolbox-2/</guid>
		<description><![CDATA[jQuery Mobile Due to the popularity of mobile devices such as the iPhone or the BlackBerry, websites are now going mobile. jQuery Mobile is a complete framework that allow you to easily create killer mobile sites. If you want an example or a demo, just have a look to this tutorial I&#8217;ve wrote a few [...]]]></description>
			<content:encoded><![CDATA[<h2>jQuery Mobile</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/bb51d_jquerymobile-large.jpg" alt="" /><br /> Due to the popularity of mobile devices such as the iPhone or the BlackBerry, websites are now going mobile. jQuery Mobile is a complete framework that allow you to easily create killer mobile sites. If you want an example or a demo, just have a look to <a href="http://www.catswhocode.com/blog/how-to-create-a-mobile-wordpress-theme-with-jquery-mobile">this tutorial I&#8217;ve wrote a few months ago</a>.<br /> And if you want me to build your mobile site, I&#8217;m your <s>cat</s> man. Just send me an email.</p>
<p><strong>&raquo;<a href="http://jquerymobile.com/">Visit jQuery Mobile</a></strong></p>
<h2>Nivo Slider</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/1ded2_nivoslider.png" alt="" /><br /> Ah, image sliders. Nothing new about them, right? Sure, but Nivo Slider is so great that I had to write about it. This jQuery plugin allow you to create images/content slider efficiently and easily.</p>
<p><strong>&raquo;<a href="http://nivo.dev7studios.com">Visit Nivo Slider</a></strong></p>
<h2>jCycle</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/1ded2_jcycle1.png" alt="" /><br /> jCycle is a new jQuery plugin dedicated to add smooth transitions to images. It supports 6 different transition types and is pretty easy to use. Freelancers, your clients will love it!</p>
<p><strong>&raquo;<a href="http://jquery.malsup.com/cycle/">Visit jCycle</a></strong></p>
<h2>Uniforms</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/9721c_uniforms.png" alt="" /><br /> Web forms are an essential aspect of a website, but theyr visual aspect is often neglected. Uniforms helps you to give a gorgeous look and feel to forms elements such as radio buttons or select drop downs, which are generally a pain to style using pure CSS.</p>
<p><strong>&raquo;<a href="http://uniformjs.com/">Visit Uniforms</a></strong></p>
<h2>Columnizer</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/9721c_columnizer.png" alt="" /><br /> Thanks to CSS3, it is now possible to display a text on X different columns easily. But as you can guess, Internet Explorer doesn&#8217;t support CSS3 yet, which means that we have to find an alternative solution to use columns on the web. Happilly, columnizer is here to help. This neat jQuery plugin will help you to render your text on columns easily.</p>
<p><strong>&raquo;<a href="http://welcome.totheinter.net/columnizer-jquery-plugin/">Visit Columnizer</a></strong></p>
<h2>Isotope</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/fc0c9_isotope.png" alt="" /><br /> Isotope is definitely an incredible jQuery plugin which allow you to create dynamic and intelligent layouts. You can hide and reveal items with filtering, re-order them with sorting, and a lot more. Of course, Isotope allow lots of cool animations. A definitive must-see for all web developers.</p>
<p><strong>&raquo;<a href="http://isotope.metafizzy.co/">Visit Isotope</a></strong></p>
<h2>jqDnR</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/fc0c9_jqDnR.png" alt="" /><br /> jqDnR is a lightweight plugin for jQuery that lets you drag, drop, and resize elements. The plugin is simple, lightweight (972 bytes) and extremely easy to implement. A great way to make your website more user-friendly.</p>
<p><strong>&raquo;<a href="http://dev.iceburg.net/jquery/jqDnR/">Visit jqDnR</a></strong></p>
<h2>jQuery Touchwipe</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/baeff_touchwipe2.png" alt="" /><br /> Do you want to create awesome images galleries for your mobile websites? If yes, then jQuery Touchwipe won&#8217;t deceive you. This plugin allows you to obtain the wipe event on an iPhone, iPad or iPod Touch which can be used for example to scroll through an image gallery. The plugin is only 1kb and works on Android as well.</p>
<p><strong>&raquo;<a href="http://www.netcu.de/jquery-touchwipe-iphone-ipad-library">Visit jQuery Touchwipe</a></strong></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/8-awesome-new-jquery-plugins-to-have-in-your-toolbox">8 awesome new jQuery plugins to have in your toolbox</a></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/baeff_yiSyU9eZheA" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-awesome-new-jquery-plugins-to-have-in-your-toolbox-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>8 awesome new jQuery plugins to have in your toolbox</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-awesome-new-jquery-plugins-to-have-in-your-toolbox/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-awesome-new-jquery-plugins-to-have-in-your-toolbox/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 20:42:26 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[alternative solution]]></category>
		<category><![CDATA[cat man]]></category>
		<category><![CDATA[going mobile]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[nivo]]></category>
		<category><![CDATA[radio buttons]]></category>
		<category><![CDATA[smooth transitions]]></category>
		<category><![CDATA[visual aspect]]></category>
		<category><![CDATA[web developers]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-awesome-new-jquery-plugins-to-have-in-your-toolbox/</guid>
		<description><![CDATA[jQuery Mobile Due to the popularity of mobile devices such as the iPhone or the BlackBerry, websites are now going mobile. jQuery Mobile is a complete framework that allow you to easily create killer mobile sites. If you want an example or a demo, just have a look to this tutorial I&#8217;ve wrote a few [...]]]></description>
			<content:encoded><![CDATA[<h2>jQuery Mobile</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/65cb1_jquerymobile-large.jpg" alt="" /><br /> Due to the popularity of mobile devices such as the iPhone or the BlackBerry, websites are now going mobile. jQuery Mobile is a complete framework that allow you to easily create killer mobile sites. If you want an example or a demo, just have a look to <a href="http://www.catswhocode.com/blog/how-to-create-a-mobile-wordpress-theme-with-jquery-mobile">this tutorial I&#8217;ve wrote a few months ago</a>.<br /> And if you want me to build your mobile site, I&#8217;m your <s>cat</s> man. Just send me an email.</p>
<p><strong>&raquo;<a href="http://jquerymobile.com/">Visit jQuery Mobile</a></strong></p>
<h2>Nivo Slider</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/98c04_nivoslider.png" alt="" /><br /> Ah, image sliders. Nothing new about them, right? Sure, but Nivo Slider is so great that I had to write about it. This jQuery plugin allow you to create images/content slider efficiently and easily.</p>
<p><strong>&raquo;<a href="http://nivo.dev7studios.com">Visit Nivo Slider</a></strong></p>
<h2>jCycle</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/35ef3_jcycle1.png" alt="" /><br /> jCycle is a new jQuery plugin dedicated to add smooth transitions to images. It supports 6 different transition types and is pretty easy to use. Freelancers, your clients will love it!</p>
<p><strong>&raquo;<a href="http://jquery.malsup.com/cycle/">Visit jCycle</a></strong></p>
<h2>Uniforms</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/35ef3_uniforms.png" alt="" /><br /> Web forms are an essential aspect of a website, but theyr visual aspect is often neglected. Uniforms helps you to give a gorgeous look and feel to forms elements such as radio buttons or select drop downs, which are generally a pain to style using pure CSS.</p>
<p><strong>&raquo;<a href="http://uniformjs.com/">Visit Uniforms</a></strong></p>
<h2>Columnizer</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/bb51d_columnizer.png" alt="" /><br /> Thanks to CSS3, it is now possible to display a text on X different columns easily. But as you can guess, Internet Explorer doesn&#8217;t support CSS3 yet, which means that we have to find an alternative solution to use columns on the web. Happilly, columnizer is here to help. This neat jQuery plugin will help you to render your text on columns easily.</p>
<p><strong>&raquo;<a href="http://welcome.totheinter.net/columnizer-jquery-plugin/">Visit Columnizer</a></strong></p>
<h2>Isotope</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/bb51d_isotope.png" alt="" /><br /> Isotope is definitely an incredible jQuery plugin which allow you to create dynamic and intelligent layouts. You can hide and reveal items with filtering, re-order them with sorting, and a lot more. Of course, Isotope allow lots of cool animations. A definitive must-see for all web developers.</p>
<p><strong>&raquo;<a href="http://isotope.metafizzy.co/">Visit Isotope</a></strong></p>
<h2>jqDnR</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/bb51d_jqDnR.png" alt="" /><br /> jqDnR is a lightweight plugin for jQuery that lets you drag, drop, and resize elements. The plugin is simple, lightweight (972 bytes) and extremely easy to implement. A great way to make your website more user-friendly.</p>
<p><strong>&raquo;<a href="http://dev.iceburg.net/jquery/jqDnR/">Visit jqDnR</a></strong></p>
<h2>jQuery Touchwipe</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/1ded2_touchwipe2.png" alt="" /><br /> Do you want to create awesome images galleries for your mobile websites? If yes, then jQuery Touchwipe won&#8217;t deceive you. This plugin allows you to obtain the wipe event on an iPhone, iPad or iPod Touch which can be used for example to scroll through an image gallery. The plugin is only 1kb and works on Android as well.</p>
<p><strong>&raquo;<a href="http://www.netcu.de/jquery-touchwipe-iphone-ipad-library">Visit jQuery Touchwipe</a></strong></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/8-awesome-new-jquery-plugins-to-have-in-your-toolbox">8 awesome new jQuery plugins to have in your toolbox</a></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/1ded2_yiSyU9eZheA" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-awesome-new-jquery-plugins-to-have-in-your-toolbox/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Killer hacks to enhance WordPress editor</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/killer-hacks-to-enhance-wordpress-editor/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/killer-hacks-to-enhance-wordpress-editor/#comments</comments>
		<pubDate>Sat, 05 Feb 2011 12:13:11 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[class style]]></category>
		<category><![CDATA[compliant]]></category>
		<category><![CDATA[default editor]]></category>
		<category><![CDATA[dirty code]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[html tags]]></category>
		<category><![CDATA[tiny mce]]></category>
		<category><![CDATA[writing html]]></category>
		<category><![CDATA[wysiwyg editors]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/killer-hacks-to-enhance-wordpress-editor/</guid>
		<description><![CDATA[Allow more HTML tags in the editor By default, WordPress editor don&#8217;t allow html tags wich aren&#8217;t compliant with the XHTML 1.0 standard. For example, iframes will be stripped out by the editor. If for some reason you have to insert an iframe into a post or page, this can be very frustrating. The code [...]]]></description>
			<content:encoded><![CDATA[<h2>Allow more HTML tags in the editor</h2>
<p>By default, WordPress editor don&#8217;t allow html tags wich aren&#8217;t compliant with the XHTML 1.0 standard. For example, iframes will be stripped out by the editor. If for some reason you have to insert an iframe into a post or page, this can be very frustrating.</p>
<p>The code below will force the editor to accept more tags. Just paste it into your theme <code>functions.php</code> file, save it, and you&#8217;re done.</p>
<pre>
function fb_change_mce_options($initArray) {
	$ext = &#039;pre&#091;id|name|class|style&#093;,iframe&#091;align|longdesc| name|width|height|frameborder|scrolling|marginheight| marginwidth|src&#093;&#039;;

	if ( isset( $initArray&#091;&#039;extended_valid_elements&#039;&#093; ) ) {
		$initArray&#091;&#039;extended_valid_elements&#039;&#093; .= &#039;,&#039; . $ext;
	} else {
		$initArray&#091;&#039;extended_valid_elements&#039;&#093; = $ext;
	}

	return $initArray;
}
add_filter(&#039;tiny_mce_before_init&#039;, &#039;fb_change_mce_options&#039;);
</pre>
<p><strong>&raquo; Source: <a href="http://wpengineer.com/1963/customize-wordpress-wysiwyg-editor/">http://wpengineer.com/1963/customize-wordpress-wysiwyg-editor/</a></strong></p>
<h2>Set HTML editor as the default</h2>
<p>I know a lot of tech-savvy persons who don’t really like WordPress “visual” editor. Personally, I don’t use it because I’m used to writing HTML, and also because WYSIWYG editors are more likely to produce bad, not valid or dirty code.</p>
<p>If you prefer using the HTML editor, then what about making it your blog default? Just paste the line below into your theme <code>functions.php</code> file, and you’re done.</p>
<pre>
add_filter('wp_default_editor', create_function('', 'return "html";'));
</pre>
<p><strong>&raquo; Source: <a href="http://www.wprecipes.com/how-to-set-html-editor-as-the-default-in-wordpress">http://www.wprecipes.com/how-to-set-html-editor-as-the-default-in-wordpress</a></strong></p>
<h2>Set default content in WordPress editor</h2>
<p>Do you always insert the same text on all your posts, for exemple to tell people to subscribe to your rss feed? If yes, you should definitely set up WP to have it automatically inserted in the editor.</p>
<p>Open your <code>functions.php</code> file, and paste this code. That&#8217;s all you need to do to define some default content.</p>
<pre>
add_filter( 'default_content', 'my_editor_content' );

function my_editor_content( $content ) {
	$content = "If you enjoyed this post, make sure to subscribe to my rss feed.";
	return $content;
}
</pre>
<p><strong>&raquo; Source: <a href="http://justintadlock.com/archives/2009/04/05/how-to-preset-text-in-the-wordpress-post-editor">http://justintadlock.com/archives/2009/04/05/how-to-preset-text-in-the-wordpress-post-editor</a></strong></p>
<h2>Add your language to spell check</h2>
<p>By default, WordPress have an English spellchecker so you can check mistakes in your posts (<em>Too bad it doesn&#8217;t work with grammar!</em>). But, what if you blog in another language than English?</p>
<p>If you want to add another language to WordPress spellcheck, that&#8217;s actually quite easy to do. Paste the following into <code>functions.php</code> to add French to the spellchecker.</p>
<pre>
function fb_mce_external_languages($initArray){
	$initArray&#091;&#039;spellchecker_languages&#039;&#093; = &#039;+French=fr, English=en&#039;;

	return $initArray;
}
add_filter(&#039;tiny_mce_before_init&#039;, &#039;fb_mce_external_languages&#039;);
</pre>
<p><strong>&raquo; Source: <a href="http://wpengineer.com/1963/customize-wordpress-wysiwyg-editor/">http://wpengineer.com/1963/customize-wordpress-wysiwyg-editor/</a></strong></p>
<h2>Add buttons to WordPress editor</h2>
<p>TinyMCE (The name of the WYSIWYG editor used by WordPress) have some buttons that allow you to make some text bold, insert paragraphs, and so on.<br /> Want to insert a custom button? It&#8217;s not so hard at all. The following code show how you can do it easily. Just paste it to your functions.php file and a &#8220;Youtube&#8221; button will be displayed into your editor. Please note that this code add a button to the editor, but do not trigger any action. If you&#8217;d like to get more info about custom buttons, have a look at the source site.</p>
<pre>
function add_youtube_button() {
   if ( ! current_user_can(&#039;edit_posts&#039;) &amp;&amp; ! current_user_can(&#039;edit_pages&#039;) )
     return;
   if ( get_user_option(&#039;rich_editing&#039;) == &#039;true&#039;) {
     add_filter(&#039;mce_external_plugins&#039;, &#039;add_youtube_tinymce_plugin&#039;);
     add_filter(&#039;mce_buttons&#039;, &#039;register_youtube_button&#039;);
   }
}

add_action(&#039;init&#039;, &#039;add_youtube_button&#039;);

function register_youtube_button($buttons) {
   array_push($buttons, &quot;|&quot;, &quot;brettsyoutube&quot;);
   return $buttons;
}

function add_youtube_tinymce_plugin($plugin_array) {
   $plugin_array[&#039;brettsyoutube&#039;] = get_bloginfo(&#039;template_url&#039;).&#039;/custom/editor_plugin.js&#039;;
   return $plugin_array;
}
</pre>
<p><strong>&raquo; Source: <a href="http://brettterpstra.com/adding-a-tinymce-button/">http://brettterpstra.com/adding-a-tinymce-button/</a></strong></p>
<h2>Set different editor stylesheets for different post types</h2>
<p>Cutom post types are definitely one of the best new things added to WordPress last year. Now, you probably created some post types to display your portfolio or some code snippets. So, what about using a different stylesheet for your editor, depending on the type of the post you&#8217;re currently writing?</p>
<p>Just paste the following code into your <code>functions.php</code> file. You&#8217;ll have to adapt it a bit, depending on your post types. Don&#8217;t forget to change the stylesheets names as well.</p>
<pre>
function my_editor_style() {
    global $current_screen;
    switch ($current_screen-&gt;post_type) {
    case &#039;post&#039;:
        add_editor_style(&#039;editor-style-post.css&#039;);
        break;
    case &#039;page&#039;:
        add_editor_style(&#039;editor-style-page.css&#039;);
        break;
    case &#039;portfolio&#039;:
        add_editor_style(&#039;editor-style-portfolio.css&#039;);
        break;
    }
}
add_action( &#039;admin_head&#039;, &#039;my_editor_style&#039; );
</pre>
<p><strong>&raquo; Source: <a href="http://wpstorm.net/2010/04/editor-styles-custom-post-types-wordpress-3-0/">http://wpstorm.net/2010/04/editor-styles-custom-post-types-wordpress-3-0/</a></strong></p>
<h2>Display hidden buttons in TinyMCE</h2>
<p>By default, the TinyMCE editor have buttons for most common tasks such as bold text, italic, titles, etc. But you may need other text formatting options, like, for example, horizontal rules.</p>
<p>To reveal hidden buttons, simply add this code to your <code>functions.php</code> file:</p>
<pre>
function enable_more_buttons($buttons) {
  $buttons[] = &#039;hr&#039;;
  $buttons[] = &#039;fontselect&#039;;
  $buttons[] = &#039;sup&#039;; 

  // etc, etc... 

  return $buttons;
}
add_filter(&quot;mce_buttons&quot;, &quot;enable_more_buttons&quot;);
</pre>
<p>The available buttons are: <em>bold</em>, <em>italic</em>, <em>underline</em>, <em>strikethrough</em>, <em>justifyleft</em>, <em>justifycenter</em>, <em>justifyright</em>, <em>justifyfull</em>, <em>bullist</em>, <em>numlist</em>, <em>outdent</em>, <em>indent</em>, <em>cut</em>, <em>copy</em>, <em>paste</em>, <em>undo</em>, <em>redo</em>, <em>link</em>, <em>unlink</em>, <em>image</em>, <em>cleanup</em>, <em>help</em>, <em>code</em>, <em>hr</em>, <em>removeformat</em>, <em>formatselect</em>, <em>fontselect</em>, <em>fontsizeselect</em>, <em>styleselect</em>, <em>sub</em>, <em>sup</em>, <em>forecolor</em>, <em>backcolor</em>, <em>charmap</em>, <em>visualaid</em>, <em>anchor</em>, <em>newdocument</em>, and <em>separator</em>.<br /> <strong>&raquo; Source: <a href="http://www.sycha.com/wordpress-add-hr-button-tinymce-visual-editor">http://www.sycha.com/wordpress-add-hr-button-tinymce-visual-editor</a></strong></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/killer-hacks-to-enhance-wordpress-editor">Killer hacks to enhance WordPress editor</a></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/507c3_27nwfDA8g28" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/killer-hacks-to-enhance-wordpress-editor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3 free WordPress themes I’ve created for you</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/3-free-wordpress-themes-i%e2%80%99ve-created-for-you/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/3-free-wordpress-themes-i%e2%80%99ve-created-for-you/#comments</comments>
		<pubDate>Sat, 05 Feb 2011 12:13:04 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[free wordpress themes]]></category>
		<category><![CDATA[gpl licence]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[menu support]]></category>
		<category><![CDATA[mimbo]]></category>
		<category><![CDATA[mobile website]]></category>
		<category><![CDATA[nav menu]]></category>
		<category><![CDATA[nyc tourism]]></category>
		<category><![CDATA[php snippets]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/3-free-wordpress-themes-i%e2%80%99ve-created-for-you/</guid>
		<description><![CDATA[Please note: These themes are offered for free, under the terms of the GPL licence. No free support or help is given. OpenBook – Magazine theme Back in 2008, when &#8220;magazine&#8221; themes where the absolute hype, I&#8217;ve released OpenBook, a &#8220;magazine&#8221; theme inspired by Darren Hoyt&#8217;s Mimbo. OpenBook was release on WPHacks, and was downloaded [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Please note:</strong> These themes are offered for free, under the terms of the GPL licence. No free support or help is given.</p>
<h2>OpenBook – Magazine theme</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/48414_openbook.png" alt="" /><br /> Back in 2008, when &#8220;magazine&#8221; themes where the absolute hype, I&#8217;ve released OpenBook, a &#8220;magazine&#8221; theme inspired by Darren Hoyt&#8217;s <a href="http://www.darrenhoyt.com/2007/08/05/wordpress-magazine-theme-released/">Mimbo</a>. OpenBook was release on WPHacks, and was downloaded more than 500 times that year.</p>
<p>Just two months ago, I&#8217;ve re-released OpenBook in a new version, which is 100% compatible with WordPress 3.0+. This new version includes wp_nav_menu() support, sidebar widgets, and the theme have a complete custom control panel where you can set-up its options.<br /> <strong>&raquo; <a href="http://www.webdevcat.com/themes">Download OpenBook</a> or view the <a href="http://www.lyxia.org">live demo</a>.</strong></p>
<h2>Snippet – Thematic child theme</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/10251_snippet.png" alt="" /><br /> Theme frameworks are quite popular these days. Most are premium themes (Genesis, Thesis) but the best one in my opinion is 100% free. This framework is called Thematic.</p>
<p>I&#8217;ve used Thematic intensively last year, on Cats Who Code, my NYC tourism blog <a href="http://www.visiter-newyork.com">Visiter New York</a> and the now abandonned blog <a href="http://www.phpsnippets.info">PHP Snippets</a>. On this last site, I&#8217;ve created a child theme named Snippet: It is simple, clean and perfect for a developer. As I know most of CWC readers are developers, I thought some of you would definitely enjoy it.</p>
<p><strong>&raquo; <a href="http://www.webdevcat.com/themes">Download Snippet</a> or view the <a href="http://www.phpsnippets.info">live demo</a>.</strong></p>
<h2>jQuery Mobile – Mobile theme</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/10251_jquerymobile.jpg" alt="" /><br /> If you&#8217;re a CWC reader for some months, you probably remember my <a href="http://www.catswhocode.com/blog/how-to-create-a-mobile-wordpress-theme-with-jquery-mobile">How to create a mobile WordPress theme with jQuery Mobile</a> article, which was a tutorial about creating a mobile theme for your WordPress blog, using the excellent framework <a href="http://jquerymobile.com/">jQuery Mobile</a>.</p>
<p>This theme, simply named <em>jQuery Mobile</em> is optimized for mobile devices such as the iPhone, Android, Blackberries, etc. It is a great basis for building a mobile website. Of course, you can also use it on your own blog, along with a plugin like <a href="http://iwphone.contentrobot.com/">IWPhone</a>, which can automatically detect a mobile device and switch from your regular theme to a mobile theme.</p>
<p><strong>&raquo; <a href="http://www.webdevcat.com/themes">Download jQuery Mobile Theme</a> or view the <a href="http://allwebdev.com/">live demo</a>.</strong></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/3-quality-free-wordpress-themes-ive-created-for-you">3 free WordPress themes I&#8217;ve created for you</a></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/10251_2dnHrOHDlb8" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/3-free-wordpress-themes-i%e2%80%99ve-created-for-you/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Awesome WordPress hacks to make your blogger life easier</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/awesome-wordpress-hacks-to-make-your-blogger-life-easier/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/awesome-wordpress-hacks-to-make-your-blogger-life-easier/#comments</comments>
		<pubDate>Sat, 11 Dec 2010 17:47:58 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[absolute path]]></category>
		<category><![CDATA[content themes]]></category>
		<category><![CDATA[default editor]]></category>
		<category><![CDATA[dirty code]]></category>
		<category><![CDATA[filetypes]]></category>
		<category><![CDATA[hardcode]]></category>
		<category><![CDATA[php function]]></category>
		<category><![CDATA[writing html]]></category>
		<category><![CDATA[wysiwyg editors]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/awesome-wordpress-hacks-to-make-your-blogger-life-easier/</guid>
		<description><![CDATA[Hardcode to make WordPress faster Hardcoding is generally not a good practice, however in the case of an established website, hardcoding your blog url, site url, template path and stylesheet path will make your blog run faster. When a function such as bloginfo('url') is called, WordPress executes a query to your database to get the [...]]]></description>
			<content:encoded><![CDATA[<h2>Hardcode to make WordPress faster</h2>
<p>Hardcoding is generally not a good practice, however in the case of an established website, hardcoding your blog url, site url, template path and stylesheet path will make your blog run faster.</p>
<p>When a function such as <code>bloginfo('url')</code> is called, WordPress executes a query to your database to get the value, except if the value can be found on your <code>wp-config.php</code> file.<br /> To hardcode those constants, edit <code>wp-config.php</code> and paste the following (Don&#8217;t forget to change the values!):</p>
<pre>define('WP_HOME', 'http://www.catswhocode.com'); // blog url
define('WP_SITEURL', 'http://www.catswhocode.com'); // site url
define('TEMPLATEPATH', '/absolute/path/to/wp-content/themes/cwc5');
define('STYLESHEETPATH', '/absolute/path/to/wp-content/themes/cwc5');</pre>
<p><strong>Source: <a href="http://digwp.com/2009/07/optimize-wordpress-performance-with-the-wp-config-php-file/">http://digwp.com/2009/07/optimize-wordpress-performance-with-the-wp-config-php-file/</a></strong></p>
<h2>Set HTML editor as the default</h2>
<p>I know a lot of tech-savvy persons who don&#8217;t really like WordPress &#8220;visual&#8221; editor. Personally, I don&#8217;t use it because I&#8217;m used to writing HTML, and also because WYSIWYG editors are more likely to produce bad, not valid or dirty code.</p>
<p>If you prefer using the HTML editor, then what about making it your blog default? Just paste the line below into your theme <code>functions.php</code> file, and you&#8217;re done.</p>
<pre>add_filter('wp_default_editor', create_function('', 'return "html";'));</pre>
<p><strong>Source: <a href="http://www.wprecipes.com/how-to-set-html-editor-as-the-default-in-wordpress">http://www.wprecipes.com/how-to-set-html-editor-as-the-default-in-wordpress</a></strong></p>
<h2>Make term edition a lot easier</h2>
<p>For some reason, WordPress uploader won’t let you upload some filetypes, such as Textmate’s .tmCommand. If you need to upload those files to your WordPress blog, here is a very nice snippet that will allow you to do it.</p>
<p>Simply paste the following code on your <code>functions.php</code> file. If needed, you can add more file types by adding them on line 4, separated by a pipe (|)</p>
<pre>&lt;?php
function addUploadMimes($mimes) {
    $mimes = array_merge($mimes, array(
        'tmbundle|tmCommand|tmDragCommand|tmSnippet|tmLanguage|tmPreferences' =&gt; 'application/octet-stream'
    ));

    return $mimes;
}
?&gt;

add_filter('upload_mimes', 'addUploadMimes');</pre>
<p><strong>Source: <a href="http://www.wprecipes.com/wordpress-tip-allow-upload-of-more-file-types">http://www.wprecipes.com/wordpress-tip-allow-upload-of-more-file-types</a></strong></p>
<h2>Remove autolinks in comments</h2>
<p>Links in comments can be a good thing when they&#8217;re useful and relevant, but unfortunely lots of people are just leaving links in your comments in order to get clicks and backlinks.<br /> As this became a recurrent problem on my blogs, I&#8217;ve looked for a solution and found a piece of code that will make urls appears as text, not as links.</p>
<p>As always, the code have to be pasted to your <code>functions.php</code> file.</p>
<pre>remove_filter('comment_text', 'make_clickable', 9);</pre>
<p><strong>Source: <a href="http://www.wprecipes.com/wordpress-hack-remove-autolinks-in-comments">http://www.wprecipes.com/wordpress-hack-remove-autolinks-in-comments</a></strong></p>
<h2>Easily modify contact info</h2>
<p>I always wondered why WordPress still has a Yahoo and a AIM field for user contact information while nowadays, services like Facebook or Twitter became a lot more popular.</p>
<p>This simple hack will remove the AIM, Yahoo and Jabber fields and will replace them with Twitter, Facebook and LinkedIn. Just paste the code below in your <code>functions.php</code> file, and you&#8217;re ready to go.</p>
<pre>function extra_contact_info($contactmethods) {
    unset($contactmethods['aim']);
    unset($contactmethods['yim']);
    unset($contactmethods['jabber']);
    $contactmethods['facebook'] = 'Facebook';
    $contactmethods['twitter'] = 'Twitter';
    $contactmethods['linkedin'] = 'LinkedIn';

    return $contactmethods;
}
add_filter('user_contactmethods', 'extra_contact_info');</pre>
<p>Advanced users would probably enjoy <a href="http://gist.github.com/618610">this class</a> which allow you to manage user contact info easily.<br /> <strong>Source: <a href="http://thomasgriffinmedia.com/blog/2010/09/how-to-add-custom-user-contact-info-in-wordpress/">http://thomasgriffinmedia.com/blog/2010/09/how-to-add-custom-user-contact-info-in-wordpress/</a></strong></p>
<h2>Leverage browser caching via .htaccess</h2>
<p>One of the easiest way to improve your blog speed and general user experience is to leverage browser caching to reduce the number of http queries that the server needs to process. In fact, static files like images or PDF documents are not likely to change often so we can improve our blog speed by telling user browsers that they don&#8217;t need to download those files again if they&#8217;re already on the browser cache.</p>
<p>Open your <code>.htaccess</code> file (located at the root of your WordPress install) and paste the following. <strong>Remember to always make a backup</strong> before editing <code>.htaccess</code>.</p>
<pre>## EXPIRES CACHING ##

ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"

## EXPIRES CACHING ##</pre>
<p><strong>Source: <a href="http://thomasgriffinmedia.com/blog/2010/11/how-to-leverage-browser-caching-in-wordpress-via-htaccess/">http://thomasgriffinmedia.com/blog/2010/11/how-to-leverage-browser-caching-in-wordpress-via-htaccess/</a></strong></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/awesome-wordpress-hacks-to-make-your-blogger-life-easier">Awesome WordPress hacks to make your blogger life easier</a></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/36309_ySWAm6UwquQ" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/awesome-wordpress-hacks-to-make-your-blogger-life-easier/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create a mobile WordPress theme with jQuery Mobile</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-mobile-wordpress-theme-with-jquery-mobile/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-mobile-wordpress-theme-with-jquery-mobile/#comments</comments>
		<pubDate>Wed, 17 Nov 2010 01:10:05 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[css file]]></category>
		<category><![CDATA[doctype html]]></category>
		<category><![CDATA[link rel]]></category>
		<category><![CDATA[mobile 1]]></category>
		<category><![CDATA[mobile files]]></category>
		<category><![CDATA[online versions]]></category>
		<category><![CDATA[script src http]]></category>
		<category><![CDATA[style css]]></category>
		<category><![CDATA[theme directory]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-mobile-wordpress-theme-with-jquery-mobile/</guid>
		<description><![CDATA[Here is what we&#8217;re going to build together today. Click the image to view the live demo. Step 1: Getting files We could have created our theme from scratch, but there&#8217;s no need to reinvent the wheel when there&#8217;s tools that can help you save lots of time. The tool we&#8217;re going to use is [...]]]></description>
			<content:encoded><![CDATA[<p>Here is what we&#8217;re going to build together today. Click the image to view the live demo.</p>
<p><a href="http://allwebdev.com" target="blank"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/b9a79_jquerymobile-large.jpg" alt="" /></a></p>
<h2>Step 1: Getting files</h2>
<p>We could have created our theme from scratch, but there&#8217;s no need to reinvent the wheel when there&#8217;s tools that can help you save lots of time. The tool we&#8217;re going to use is called Blank Theme. It is a functional WordPress theme, but without any styling. That way, it can be used as a starting point for creating your own themes. For example, I&#8217;ve used Blank Theme to create the current Cats Who Code theme.</p>
<p>Blank Theme has been created by Chris Coyier and it can be downloaded <a href="http://digwp.com/2010/02/blank-wordpress-theme/">here</a>. Get a copy and unzip it on your server or hard drive: We&#8217;re going to start. Optionally, open the <code>style.css</code> file and modify the theme name to fit your own needs.</p>
<h2>Step 2: Header and Footer files</h2>
<p>As we&#8217;re going to create a theme that will rely much on jQuery, the first thing we have to do is to link to jQuery and the jQuery Mobile files. You can either download the files individually and link them to the theme, or you can use jQuery&#8217;s CDN and link the online versions to your theme. I personally prefer linking to the online version, but it&#8217;s up to you.</p>
<p>Open the <code>header.php</code> file from the Blank Theme directory, and insert the following code to link to jQuery Mobile, within the <code>&lt;head&gt;</code> and <code>&lt;/head&gt;</code> tags:</p>
<pre>&lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.css" /&gt;
&lt;script src="http://code.jquery.com/jquery-1.4.3.min.js"&gt;&lt;/script&gt;
&lt;script src="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.js"&gt;&lt;/script&gt;</pre>
<p>Once done, the required jQuery files are now linked to our theme. But we&#8217;re not done yet with <code>header.php</code>. As jQuery Mobile uses HTML5, we have to modify the doctype. Replace the first 6 lines of the file with:</p>
<pre>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;</pre>
<p>Then, scroll down to the bottom of the file and locate the <code>&lt;body&gt;</code> tag. Replace everything from the <code>&lt;body&gt;</code> tag until the end of the file by the following:</p>
<pre>&lt;body &lt;?php body_class(); ?&gt;&gt;
    &lt;div data-role="page" data-theme="b" id="jqm-home"&gt;
        &lt;div data-role="header"&gt;
            &lt;h1&gt;&lt;?php bloginfo('name'); ?&gt;&lt;/h1&gt;
	&lt;/div&gt;

        &lt;div data-role="content"&gt;</pre>
<p>We just dove in jQuery Mobile with the code above. <em>What? We haven&#8217;t even wrote a single line of JavaScript!</em> That&#8217;s right. jQuery Mobile doesn&#8217;t need you to write any JavaScript. All it needs is some <code>&lt;div&gt; tags</code> with the proper <code>data-role</code> attribute.</p>
<p>As an explanation, take a look at line 3 of the code above. Have you noticed the <code>data-role="header"</code>? It describe a header bar. If you save the file and view your theme right now, you&#8217;ll notice a header bar on the top of the screen, with your blog name.</p>
<p>Now, save <code>header.php</code> and open <code>footer.php</code>. Replace its content by:</p>
<pre>        &lt;/div&gt;&lt;!-- data role content--&gt;

        &lt;div data-role="footer" class="ui-bar"&gt;
            &lt;a href="#jqm-home" data-role="button" data-icon="arrow-u"&gt;Up&lt;/a&gt;&lt;/div&gt;
        &lt;?php wp_footer(); ?&gt;
    &lt;/div&gt;&lt;!-- data role content--&gt;
&lt;/body&gt;</pre>
<p>This simple code will insert a footer bar to our theme, with a button that will scroll up to the header when the user will tap on it. Did you noticed the <code>data-icon</code> attribute? It allows you to specify which kind of icon you want. In our case, we want an up arrow, but there&#8217;s lots of different icons you can use.</p>
<h2>Step 3: The homepage</h2>
<p>Now, let&#8217;s code our homepage. As we&#8217;re building a theme for mobile devices, we do not need anything fancy. Let&#8217;s build a list of our recent posts. To do so, open the <code>index.php</code> file, locate the loop, and replace it by the following code:</p>
<pre>&lt;ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b"&gt;
    &lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;
        &lt;li&gt;&lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;?php endwhile;endif ?&gt;
&lt;/ul&gt;
&lt;?php include (TEMPLATEPATH . '/inc/nav.php' ); ?&gt;</pre>
<p>Save the file and take a look to your theme: It looks great! We now have a list of posts on our homepage. Once again, we have a very good looking list, with some nice transition effects, without coding a single line of JavaScript. That&#8217;s the magic of jQuery mobile.</p>
<p>The list is created by using the <code>data-role="listview"</code> attribute on the unordered list. The other attributes specifies the appearance of the list. Want to experiment a bit? Simply replace <code>data-theme="c"</code> by <code>data-theme="b"</code> and see what happens.</p>
<p>Now, modify the loops of the <code>search.php</code> and <code>archive.php</code> files like we did with <code>index.php</code>.</p>
<h2>Step 4: Post and pages files</h2>
<p>By default, the <code>single.php</code> and <code>page.php</code> files from the Blank Theme looks good in our mobile version, so we do not need to modify those files. Though, we can do something to enhance user experience: Mask the comments by default, and show them only if the user decides to. This can be done extremely easily using jQuery mobile.</p>
<p>Open <code>comments.php</code> and locate line 15. Insert the following line:</p>
<pre>&lt;div data-role="collapsible" data-state="collapsed"&gt;</pre>
<p>Then, go to line 31 and insert a closing <code>&lt;/div&gt;</code> just before the <code>else</code> statement. Save the file and have a look at one of your posts: Comments are now masked by default, and a tap/click on the bar display them. If you prefer to show the comments by default, no problem: simply remove the <code>data-state="collapsed"</code> attribute. That&#8217;s all we need to create a collapsible content block.</p>
<p>Did you noticed that on posts, the header bar is showing a &#8220;Back&#8221; button? A click/tap on it will take you back to your blog homepage.</p>
<h2>Step 5: Implementing search</h2>
<p>Right now, we have a theme fully optimized for mobile devices. But it is missing something important: An easy to access search bar. Open your <code>searchform.php</code> file and replace its content by the following:</p>
<pre>&lt;form action="&lt;?php bloginfo('siteurl'); ?&gt;" id="searchform" method="get"&gt;
    &lt;div data-role="fieldcontain"&gt;
	    &lt;input type="search" name="s" id="search" value="" /&gt;
	&lt;/div&gt;
&lt;/form&gt;</pre>
<p>After you saved the file, reopen <code>index.php</code> and include the search form between the <code>get_header()</code> function and the unordered list which contain our posts:</p>
<pre>&lt;?php include('searchform.php'); ?&gt;</pre>
<p>Our homepage now has a working search form. Right now, our theme is done and we can use it on a production site.</p>
<h2>Step 6: Final touches</h2>
<p>Of course, even if the theme we&#8217;ve built is perfectly functional, there are still a lot of things that can be done to enhance its look and functionality. For example, I have noticed that the search field is smaller than the list items. In order to make the search field as wide as the list items, paste the following in <code>style.css</code>:</p>
<pre>.ui-input-search{
    width:96% !important;
}</pre>
<p>That&#8217;s all for today. I hope you enjoyed this tutorial. If you want to download the finished theme, just click <a href="http://www.webdevcat.com/themes">here</a>.</p>
<p>Also, I just redesigned my other blog <a href="http://www.catswhoblog.com">Cats Who Blog</a> so don&#8217;t hesitate to visit it or <a href="http://feeds.feedburner.com/catswhoblog">grab the RSS feed</a> to read it later. The blog is now 100% focused on tools to make your life as a blogger, developer or designer easier. Enjoy!</p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/how-to-create-a-mobile-wordpress-theme-with-jquery-mobile">How to create a mobile WordPress theme with jQuery Mobile</a></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/b9a79_jvw7OnFDg5Y" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-mobile-wordpress-theme-with-jquery-mobile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP snippets to interact with Twitter</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/php-snippets-to-interact-with-twitter/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/php-snippets-to-interact-with-twitter/#comments</comments>
		<pubDate>Mon, 08 Nov 2010 23:36:47 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[followers]]></category>
		<category><![CDATA[footer]]></category>
		<category><![CDATA[lt]]></category>
		<category><![CDATA[php snippets]]></category>
		<category><![CDATA[screen name]]></category>
		<category><![CDATA[statuses]]></category>
		<category><![CDATA[true c]]></category>
		<category><![CDATA[Tweet]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/php-snippets-to-interact-with-twitter/</guid>
		<description><![CDATA[Get number of Twitter followers Have you seen my blog sidebar? I display the number of followers I have in full text. This is actually pretty easy to do. The first thing you need is this function: function get_followers($twitter_id){ $xml=file_get_contents('http://twitter.com/users/show.xml?screen_name='.$twitter_id); if (preg_match('/followers_count&#62;(.*)&#60;/',$xml,$match)!=0) { $tw['count'] = $match[1]; } return $tw['count']; } Once you have the function, [...]]]></description>
			<content:encoded><![CDATA[<h2>Get number of Twitter followers</h2>
<p>Have you seen my blog sidebar? I display the number of followers I have in full text. This is actually pretty easy to do. The first thing you need is this function:</p>
<pre>function get_followers($twitter_id){
	$xml=file_get_contents('http://twitter.com/users/show.xml?screen_name='.$twitter_id);
	if (preg_match('/followers_count&gt;(.*)&lt;/',$xml,$match)!=0) {
		$tw['count'] = $match[1];
	}

	return $tw['count'];
}</pre>
<p>Once you have the function, you can call it as shown below:</p>
<pre>$nb =  get_followers('phpsnippets');
echo "PHP Snippets already have ".$nb." followers!";</pre>
<p><strong>» Credit: <a href="http://www.phpsnippets.info/get-twitters-followers-in-php">http://www.phpsnippets.info/get-twitters-followers-in-php</a></strong></p>
<h2>Get latest Twitter status</h2>
<p>Using PHP and cURL, it is pretty easy to get the status of a specific user. Once you have it, what about displaying it on your blog, like I do in <a href="http://www.wprecipes.com">WPRecipes</a> footer?</p>
<pre>function get_status($twitter_id, $hyperlinks = true) {
    $c = curl_init();
    curl_setopt($c, CURLOPT_URL, "http://twitter.com/statuses/user_timeline/$twitter_id.xml?count=1");
    curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
    $src = curl_exec($c);
    curl_close($c);
    preg_match('/&lt;text&gt;(.*)&lt;\/text&gt;/', $src, $m);
    $status = htmlentities($m[1]);
    if( $hyperlinks ) $status = ereg_replace("[[:alpha:]]+://[^&lt;&gt;[:space:]]+[[:alnum:]/]", '&lt;a href="%5C%22%5C%5C0%5C%22"&gt;\&lt;/a&gt;', $status);
    return($status);
}</pre>
<p>The function is extremely easy to use:</p>
<pre>echo get_status('catswhocode');</pre>
<p><strong>» <a href="http://www.phpsnippets.info/get-twitter-status-using-php">http://www.phpsnippets.info/get-twitter-status-using-php</a></strong></p>
<h2>Link to update status, without encoding problems</h2>
<p>Many websites and blogs show you how to create a link to Twitter that will update your status. But unfortunely, most websites don&#8217;t explain what you need to do in order to avoid encoding problems of spaces and special characters.</p>
<pre>&lt;a href="http://twitter.com?status=@catswhocode Hi Jean, how are you?"&gt;Tweet!&lt;/a&gt;</pre>
<p>So, where&#8217;s the change? Pretty simple: Just note that I havent linked to <code>http://www.twitter.com</code>, but to <code>http://twitter.com</code>, without the www.</p>
<p>A working example can be seen on my company website: <a href="http://www.webdevcat.com/contact">http://www.webdevcat.com/contact</a>.</p>
<h2>Get number of retweets for a specific page</h2>
<p>Most bloggers are using the Tweetmeme widget to display the number of retweets of their posts. Did you know that Tweetmeme also has an API you can use to get how many times a specific url has been retweeted?</p>
<p>The following function will get the number of RT&#8217;s of the url passed as a parameter:</p>
<pre>function tweetCount($url) {
    $content = file_get_contents("http://api.tweetmeme.com/url_info?url=".$url);
    $element = new SimpleXmlElement($content);
    $retweets = $element-&gt;story-&gt;url_count;
    if($retweets){
        return $retweets;
    } else {
        return 0;
    }
}</pre>
<p>Using the function is easy, as you can expect:</p>
<pre>echo tweetCount('http://www.catswhocode.com');</pre>
<p>Note that the Twitter API also provide a way to get the number of retweets. See <a href="http://urls.api.twitter.com/1/urls/count.json?url=www.google.com">http://urls.api.twitter.com/1/urls/count.json?url=www.google.com</a> for example.</p>
<p><strong>» <a href="http://www.phpsnippets.info/get-how-many-times-a-page-have-been-retweeted-using-php">http://www.phpsnippets.info/get-how-many-times-a-page-have-been-retweeted-using-php</a></strong></p>
<h2>Testing friendship between two users</h2>
<p>If you want to know if a specific user is following you (or someone else) you have to use the Twitter API. This snippet will echo <code>true</code> if the two users specified on lines 18 and 19 are friends. It will return <code>false</code> otherwise.</p>
<pre>/* makes the request */
function make_request($url) {
	$ch = curl_init();
	curl_setopt($ch,CURLOPT_URL,$url);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
	$result = curl_exec($ch);
	curl_close($ch);
	return $result;
}

/* gets the match */
function get_match($regex,$content) {
	preg_match($regex,$content,$matches);
	return $matches[1];
}

/* persons to test */
$person1 = 'phpsnippets';
$person2 = 'catswhocode';

/* send request to twitter */
$url = 'https://api.twitter.com/1/friendships/exist';
$format = 'xml';

/* check */
$persons12 = make_request($url.'.'.$format.'?user_a='.$person1.'&amp;user_b='.$person2);
$result = get_match('/&lt;friends&gt;(.*)&lt;\/friends&gt;/isU',$persons12);
echo $result; // returns "true" or "false"</pre>
<p><strong>» <a href="http://www.phpsnippets.info/get-twitter-status-using-php">http://www.phpsnippets.info/get-twitter-status-using-php</a></strong></p>
<h2>Shorten urls for Twitter</h2>
<p>As you know if you&#8217;re a Twitter user, you can&#8217;t post messages which are longer than 140 characters. To avoid this problem, you have to use an url shortener. There&#8217;s lots of different url shorteners on the internet. TinyUrl.com is one of them, it doesn&#8217;t produce the shortest urls but what I really love it is that you don&#8217;t need to have an account to use it with PHP.</p>
<p>The following function takes a long url as a parameter and return a shorter url, using the TinyUrl url shortener.</p>
<pre>function getTinyUrl($url) {
    return file_get_contents("http://tinyurl.com/api-create.php?url=".$url);
}</pre>
<p><strong>» <a href="http://www.phpsnippets.info/convert-url-to-tinyurl">http://www.phpsnippets.info/convert-url-to-tinyurl</a></strong></p>
<h2>Shorten urls using Bit.ly</h2>
<p>In the previous snippet of that article, I&#8217;ve shown you how you can shorten your urls using TinyUrl.com. This is cool, but I&#8217;m pretty sure some of you prefer using the bit.ly service. No problem, you can still use PHP to get your shortened url.</p>
<pre>function bitly($url) {
	$content = file_get_contents("http://api.bit.ly/v3/shorten?login=YOURLOGIN&amp;apiKey=YOURAPIKEY&amp;longUrl=".$url."&amp;format=xml");
	$element = new SimpleXmlElement($content);
	$bitly = $element-&gt;data-&gt;url;
	if($bitly){
		return $bitly;
	} else {
		return '0';
	}
}</pre>
<p>To use the function, simply use the following:</p>
<pre>echo bitly("http://www.catswhocode.com");</pre>
<p><strong>» <a href="http://woorkup.com/2010/06/06/3-practical-wordpress-code-snippets-you-probably-must-know/">http://woorkup.com/2010/06/06/3-practical-wordpress-code-snippets-you-probably-must-know/</a></strong></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/php-snippets-to-interact-with-twitter">PHP snippets to interact with Twitter</a></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/d219e_BsQGQNo5n8E" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/php-snippets-to-interact-with-twitter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: Fast and easy SQL queries using ezSQL</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/php-fast-and-easy-sql-queries-using-ezsql/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/php-fast-and-easy-sql-queries-using-ezsql/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 20:25:12 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[application website]]></category>
		<category><![CDATA[database abstraction layer]]></category>
		<category><![CDATA[ezsql]]></category>
		<category><![CDATA[mysql database]]></category>
		<category><![CDATA[mysql oracle]]></category>
		<category><![CDATA[php functions]]></category>
		<category><![CDATA[postgres]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[sql queries]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/php-fast-and-easy-sql-queries-using-ezsql/</guid>
		<description><![CDATA[What&#8217;s ezSQL, and why it is useful On big projects, the usual good practice is to use a CMS or a framework such as Symfony or CodeIgniter to build your site on. But on smaller projects, many developers are still using PHP functions such as mysql_query() to do SQL queries to the database. While it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<h2>What&#8217;s ezSQL, and why it is useful</h2>
<p>On big projects, the usual good practice is to use a CMS or a framework such as Symfony or CodeIgniter to build your site on. But on smaller projects, many developers are still using PHP functions such as <code>mysql_query()</code> to do SQL queries to the database.</p>
<p>While it&#8217;s functional, I do not recommend to use all those <code>mysql_XXX</code> functions: Most websites are using MySQL, that&#8217;s right, but if one day you have to deal with another DB like PostGres or Oracle&#8230; Your code will not work at all, and you&#8217;ll have to rewrite it. Scary, isn&#8217;t it? This is why is it recommended to use a <em>database abstraction layer</em>, an API which unifies the communication between your application/website and databases such as MySQL, Oracle or PostgreSQL.</p>
<p>As you can guess, ezSQL allows you to work with various databases very easily. Though, please note that it does not support differences in SQL syntax implementations among different databases.</p>
<p>Also, ezSQL provide a few methods which simplify queries to the database, and help producing a cleaner code.</p>
<h2>ezSQL and WordPress</h2>
<p>As most of you are familiar with WordPress, you probably know the <code>wpdb</code> class, which allows you to send queries to the database. As wpdb is based on ezSQL, and you&#8217;re already familiar with the WordPress class, you won&#8217;t have any trouble to learn using ezSQL. And don&#8217;t worry if you never heard of WordPress or the wpdb class. ezSQL is extremely easy to learn and to use.</p>
<h2>Downloading and installing ezSQL</h2>
<p>Right, I have talked too much. How about some coding now? Let start by <a href="http://justinvincent.com/ezsql">grabbing your copy of ezSQL</a>. Once you have it, unzip on your server (or hard drive).</p>
<p>In order to be able to use ezSQL in your projects, you have to include two files: The first is <code>ez_sql_core.php</code>, which is ezSQL core file. The second depends on the database you&#8217;re going to use. In order to use ezSQL with a MySQL database, you have to include <code>ez_sql_mysql.php</code>.</p>
<p>Once done, you have to create a ezSQL object. This is done easily using your database username, password, name and host. The following example demonstrates the inclusion of the required files and the creation of a ezSQL object:</p>
<pre>include_once "../shared/ez_sql_core.php";
include_once "ez_sql_mysql.php";
$db = new ezSQL_mysql('db_user','db_password','db_name','db_host');</pre>
<p>Now, you have an object called <code>$db</code>. We&#8217;ll use it run any types of queries to our database.</p>
<h2>Queries examples</h2>
<p>ezSQL has a few methods to make SQL queries extremely simple. Let&#8217;s see what you can do with it:</p>
<h3>Execute any query</h3>
<p>In order to insert, delete or most generally, run any kind of query to the database, we have to use the <code>query</code> method. In case of a data insertion, the method will return the insert id.</p>
<pre>$db-&gt;query("INSERT INTO users (id, name, email) VALUES (NULL,'The Cat','cat@google.com')");</pre>
<p>Example of an update query:</p>
<pre>$db-&gt;query("UPDATE users SET name = 'Patrick' WHERE id = 4");</pre>
<h3>Select a row</h3>
<p>The <code>get_row</code> method is great if you just need to select a row from your database. The example below executes a simple select query and displays the results.</p>
<pre>$user = $db-&gt;get_row("SELECT name, email FROM users WHERE id = 4");

echo $user-&gt;name;
echo $user-&gt;email;</pre>
<h3>Select a single variable</h3>
<p>If you only need a variable, the <code>get_var</code> method is here to help. Using it is extremely simple as shown below.</p>
<pre>$var = $db-&gt;get_var("SELECT count(*) FROM users");

echo $var;</pre>
<h3>Select multiple results</h3>
<p>Although the methods documented above are quite useful, most of the time you&#8217;ll need to get various rows of data from your database. The method called <code>get_results</code> will get various data from your database. To output the data, a simple <code>foreach()</code> loop is all you need.</p>
<pre>$results = $db-&gt;get_results("SELECT name, email FROM users");

foreach ( $results as $user ) {
    echo $user-&gt;name;
    echo $user-&gt;email;
}</pre>
<h3>Select a column</h3>
<p>If you need to get a column, you can use the get_col method. The second parameter is the column offset.</p>
<pre>foreach ( $db-&gt;get_col("SELECT name,email FROM users",0) as $name ) {
            echo $name;
}</pre>
<h3>Debug</h3>
<p>When something doesn&#8217;t work as expected, ezSQL has a great method to perform some debugging. Not surprising, the method is called <code>debug</code>. When called, the method will display the last query performed and its associated results.</p>
<pre>$db-&gt;debug();</pre>
<p>I hope you enjoyed this article and that you&#8217;ll use ezSQL in your future projects. It&#8217;s a great tool which was very helpful for me many times!</p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/php-fast-and-easy-sql-queries-using-ezsql">PHP: Fast and easy SQL queries using ezSQL</a></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/1fbe4_X9WsGnNB52I" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/php-fast-and-easy-sql-queries-using-ezsql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create a kick-ass CSS3 progress bar</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-kick-ass-css3-progress-bar/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-kick-ass-css3-progress-bar/#comments</comments>
		<pubDate>Mon, 11 Oct 2010 16:29:58 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[css styles]]></category>
		<category><![CDATA[div class]]></category>
		<category><![CDATA[div id]]></category>
		<category><![CDATA[doctype html]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[label style]]></category>
		<category><![CDATA[meta charset]]></category>
		<category><![CDATA[progress bar]]></category>
		<category><![CDATA[span class]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-kick-ass-css3-progress-bar/</guid>
		<description><![CDATA[Please note: The original CSS3 progress bar shown in this tutorial has been created by Ivan Vanderbyl, which hereby gave me the right to reproduce and document his work. The following tutorial and the demo works best on Chrome and Safari, correctly on Firefox and very badly in Internet Explorer (eh&#8230;I&#8217;m sure you hadn&#8217;t guessed [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Please note:</strong> The original CSS3 progress bar shown in this tutorial has been created by <a href="http://ivanvanderbyl.com/">Ivan Vanderbyl</a>, which hereby gave me the right to reproduce and document his work.<br /> The following tutorial and the demo works best on Chrome and Safari, correctly on Firefox and very badly in Internet Explorer (eh&#8230;I&#8217;m sure you hadn&#8217;t guessed that).</p>
<h2>The Demo</h2>
<p><a href="http://skunkworks.ivanvanderbyl.com/" target="blank"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/236e3_pure-css3-progress-bar.jpg" alt="" /></a><br /> Click on the image to view a live demo. You can also <a href="http://github.com/ivanvanderbyl/ui-progress-bar">get the source on Github</a>.</p>
<h2>Getting ready</h2>
<p>Let&#8217;s start by organizing our work. To achieve the effect of this tutorial, we&#8217;ll need to create 3 files:</p>
<ul>
<li><code>progress.html</code>, which will contain our markup.</li>
<li><code>ui.css</code> which will contain our CSS styles.</li>
<li><code>progress.js</code> which will contain some additional jQuery animations.</li>
</ul>
<p>Create a directory on your webserver (or hard drive) and create the files.</p>
<h2>The HTML markup</h2>
<p>Here we go. Open your <code>progress.html</code> file and paste the following markup in it:</p>
<pre>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
	&lt;meta charset="utf-8"&gt;
	&lt;title&gt;Pure CSS Progress Bar&lt;/title&gt;

	&lt;link rel="stylesheet" href="stylesheets/ui.css"&gt;
	&lt;link rel="stylesheet" href="stylesheets/ui.progress-bar.css"&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;div id="container"&gt;
		&lt;div id="progress_bar" class="ui-progress-bar ui-container"&gt;
        	&lt;div class="ui-progress" style="width: 79%;"&gt;
				&lt;span class="ui-label" style="display:none;"&gt;Processing &lt;b class="value"&gt;79%&lt;/b&gt;&lt;/span&gt;
      		&lt;/div&gt;&lt;!-- .ui-progress --&gt;
    	&lt;/div&gt;&lt;!-- #progress_bar --&gt;  

		&lt;div class="content" id="main_content" style="display: none;"&gt;
	    	&lt;p&gt;Hello, World!&lt;/p&gt;
	  	&lt;/div&gt;&lt;!-- #main_content --&gt;
	&lt;/div&gt;&lt;!-- #container --&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>Let me explain the code a bit: On line 1, I&#8217;ve declared a HTML5 doctype. Then, lines 12 to 16 contains the markup for the progress bar itself. If you save the file and view it in your browser right now, you&#8217;ll see that nothing appears. Don&#8217;t worry, we&#8217;re going to apply so CSS3 magic in a minute.</p>
<h2>Diving into CSS3</h2>
<p>Open your <code>ui.css</code> file and paste the following code in it. There&#8217;s nothing fancy there, just some basic styles (that I&#8217;ve simplified from the original source) for the layout.</p>
<pre>body {
  background:#eee;
  padding: 30px;
  font-size: 62.5%;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  position: relative;
  margin: 0;
}

#container {
  margin: 0 auto;
  width: 460px;
  padding: 2em;
  background: #DCDDDF;

}

.ui-progress-bar {
  margin-top: 3em;
  margin-bottom: 3em;
} 

.ui-progress span.ui-label {
  font-size: 1.2em;
  position: absolute;
  right: 0;
  line-height: 33px;
  padding-right: 12px;
  color: rgba(0,0,0,0.6);
  text-shadow: rgba(255,255,255, 0.45) 0 1px 0px;
  white-space: nowrap;
}</pre>
<p>Once you are done, we can finally get into more serious things. The code below will make your progress bar come to life. I&#8217;ll explain it in details in a minute. For now, copy it and paste it in your <code>ui.css</code> file.</p>
<pre>@-webkit-keyframes animate-stripes {
  from {
    background-position: 0 0;
  }

  to {
   background-position: 44px 0;
  }
}      

.ui-progress-bar {
  position: relative;
  height: 35px;
  padding-right: 2px;
  background-color: #abb2bc;
  border-radius: 35px;
  -moz-border-radius: 35px;
  -webkit-border-radius: 35px;
  background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #b6bcc6), color-stop(1, #9da5b0));
  background: -moz-linear-gradient(#9da5b0 0%, #b6bcc6 100%);
  -webkit-box-shadow: inset 0px 1px 2px 0px rgba(0, 0, 0, 0.5), 0px 1px 0px 0px #FFF;
  -moz-box-shadow: inset 0px 1px 2px 0px rgba(0, 0, 0, 0.5), 0px 1px 0px 0px #FFF;
  box-shadow: inset 0px 1px 2px 0px rgba(0, 0, 0, 0.5), 0px 1px 0px 0px #FFF;
}        

.ui-progress {
  position: relative;
  display: block;
  overflow: hidden;
  height: 33px;
  -moz-border-radius: 35px;
  -webkit-border-radius: 35px;
  border-radius: 35px;
  -webkit-background-size: 44px 44px;
  background-color: #74d04c;
  background: -webkit-gradient(linear, 0 0, 44 44,
    color-stop(0.00, rgba(255,255,255,0.17)),
    color-stop(0.25, rgba(255,255,255,0.17)),
    color-stop(0.26, rgba(255,255,255,0)),
    color-stop(0.50, rgba(255,255,255,0)),
    color-stop(0.51, rgba(255,255,255,0.17)),
    color-stop(0.75, rgba(255,255,255,0.17)),
    color-stop(0.76, rgba(255,255,255,0)),
    color-stop(1.00, rgba(255,255,255,0))
  ), -webkit-gradient(linear, left bottom, left top, color-stop(0, #74d04c), color-stop(1, #9bdd62));
  background: -moz-repeating-linear-gradient(top left -30deg,
    rgba(255,255,255,0.17),
    rgba(255,255,255,0.17) 15px,
    rgba(255,255,255,0) 15px,
    rgba(255,255,255,0) 30px
  ), -moz-linear-gradient(#9bdd62 0%, #74d04c 100%);
  -webkit-box-shadow: inset 0px 1px 0px 0px #dbf383, inset 0px -1px 1px #58c43a;
  -moz-box-shadow: inset 0px 1px 0px 0px #dbf383, inset 0px -1px 1px #58c43a;
  box-shadow: inset 0px 1px 0px 0px #dbf383, inset 0px -1px 1px #58c43a;
  border: 1px solid #4c8932;
  -webkit-animation: animate-stripes 2s linear infinite;
}</pre>
<p>Save your <code>ui.css</code> file and view <code>progress.html</code> in your web browser, and you&#8217;ll see your gorgeous progress bar, done without using any image.<br /> So, what&#8217;s inside? Let me explain the code a bit.</p>
<p>First, we have two CSS classes: <code>.ui-progress-bar</code> and <code>.ui-progress</code>. The first is the container, and the second is the green progress bar.</p>
<ul>
<li><strong>Lines 1 to 9:</strong> These lines define a webkit-specific animation, which allows us to move an element from a pint to another.<br /> For more details about webkit animations, see <a href="http://webkit.org/blog/324/css-animation-2/">http://webkit.org/blog/324/css-animation-2/</a>.</li>
<li><strong>Line 16:</strong> The <code>border-radius</code> CSS3 property allows you to define a radius and get rounded corners.</li>
<li><strong>Line 17:</strong> Mozilla specific property for <code>border-radius</code>.</li>
<li><strong>Line 18:</strong> Webkit specific property for <code>border-radius</code>.</li>
<li><strong>Line 19:</strong> The -webkit-gradient property allows you to add a gradient to an element. It works only on Webkit, other browsers will ignore this property.</li>
<li><strong>Line 20:</strong> Mozilla specific property, similar to <code>-webkit-gradient</code> with a different syntax.</li>
<li><strong>Lines 21 to 23:</strong> <code>box-shadow</code> (and its browser specific alternatives) allows you to add a shadow to an element.</li>
<li><strong>Line 34:</strong> Webkit specific property, based on the standard <code>background-size</code> property, which allows you to specify the size of a background image.</li>
<li><strong>Line 56:</strong> Triggers webkit animation defined on line 1.</li>
</ul>
<h2>Final touch: Using jQuery to animate the progress bar</h2>
<p>A pure CSS3 progress bar is a very cool thing, but progress bars are here to show progress, so we have to animate it. We&#8217;re going to use jQuery to do so.</p>
<p>Open your <code>progress.html</code> file and paste the two line below just above the closing<code>&lt;/body&gt;</code> tag.</p>
<pre>&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;
&lt;script src="progress.js" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;</pre>
<p>This code will load jQuery from Google (Which I recommend to do instead of loading your own copy) as well as your <code>progress.js</code> file, which will contain the required code to animate the progress bar.</p>
<p>Now, paste the code below in your <code>progress.js</code> file:</p>
<pre>(function( $ ){
  $.fn.animateProgress = function(progress, callback) {
    return this.each(function() {
      $(this).animate({
        width: progress+'%'
      }, {
        duration: 2000, 

        easing: 'swing',

        step: function( progress ){
          var labelEl = $('.ui-label', this),
              valueEl = $('.value', labelEl);

          if (Math.ceil(progress) &lt; 20 &amp;&amp; $('.ui-label', this).is(":visible")) {
            labelEl.hide();
          }else{
            if (labelEl.is(":hidden")) {
              labelEl.fadeIn();
            };
          }

          if (Math.ceil(progress) == 100) {
            labelEl.text('Done');
            setTimeout(function() {
              labelEl.fadeOut();
            }, 1000);
          }else{
            valueEl.text(Math.ceil(progress) + '%');
          }
        },
        complete: function(scope, i, elem) {
          if (callback) {
            callback.call(this, i, elem );
          };
        }
      });
    });
  };
})( jQuery );

$(function() {
  $('#progress_bar .ui-progress .ui-label').hide();
  $('#progress_bar .ui-progress').css('width', '7%');

  $('#progress_bar .ui-progress').animateProgress(43, function() {
    $(this).animateProgress(79, function() {
      setTimeout(function() {
        $('#progress_bar .ui-progress').animateProgress(100, function() {
          $('#main_content').slideDown();
        });
      }, 2000);
    });
  });

});</pre>
<p>Save the file, and view <code>progress.html</code> in your web brower: Wow, the progress bar is now animated. How cool is that?</p>
<p>This Javascript code makes the progress bar go from 0 to 100, and then, it displays a message, which is simply &#8220;Hello World&#8221; in our tutorial.</p>
<p>I hope you enjoyed reading this tutorial as much as I enjoyed writing it. Have fun with CSS3!</p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/how-to-create-a-kick-ass-css3-progress-bar">How to create a kick-ass CSS3 progress bar</a></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/236e3_o09HNmakQlQ" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-kick-ass-css3-progress-bar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best practices for modern Javascript development</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/best-practices-for-modern-javascript-development/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/best-practices-for-modern-javascript-development/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 13:43:59 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[code lt]]></category>
		<category><![CDATA[decrement]]></category>
		<category><![CDATA[javascript code]]></category>
		<category><![CDATA[javascript development]]></category>
		<category><![CDATA[language javascript]]></category>
		<category><![CDATA[script type]]></category>
		<category><![CDATA[text javascript]]></category>
		<category><![CDATA[unwanted results]]></category>
		<category><![CDATA[weird problems]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/best-practices-for-modern-javascript-development/</guid>
		<description><![CDATA[Use the correct &#60;script&#62; tag When you have to use some Javascript in an html file, you should always use the following &#60;script&#62; tag: &#60;script type="text/javascript"&#62; ... some JS code &#60;/script&#62; But instead, how many times have you seen this when looking at the source code? &#60;script type="text/javascript" language="javascript"&#62; ... some JS code &#60;/script&#62; In [...]]]></description>
			<content:encoded><![CDATA[<h2>Use the correct &lt;script&gt; tag</h2>
<p>When you have to use some Javascript in an html file, you should always use the following <code>&lt;script&gt;</code> tag:</p>
<pre>&lt;script type="text/javascript"&gt;
    ... some JS code
&lt;/script&gt;</pre>
<p>But instead, how many times have you seen this when looking at the source code?</p>
<pre>&lt;script type="text/javascript" language="javascript"&gt;
    ... some JS code
&lt;/script&gt;</pre>
<p>In HTML, the <code>language</code> attribute is deprecated due to its redundancy with the <code>type</code> attribute. You should never use it anymore.</p>
<h2>Keep your code in an external file</h2>
<p>Using an external <code>.js</code> file for your Javascript code is a lot cleaner than writing it in your html document, and it also allows the browser to cache the file, which will result in a faster website.</p>
<p>Put your Javascript code in a <code>.js</code> file, then use the <code>&lt;script&gt;</code> tag in your html document to import the file:</p>
<pre>&lt;script type='text/javascript' src='http://www.catswhocode.com/myscript.js'&gt;&lt;/script&gt;</pre>
<h2>Don&#8217;t wrap code in HTML comments</h2>
<p>In the 90&#8242;s some very old browsers weren&#8217;t able to interpret Javascript. In order to prevent unwanted results on those browsers, it was considered good practice in 1994-1997 to wrap Javascript code within html comments, so browsers with no Javascript support will simply ignore it.<br /> Here is an example of some code wrapped within html comments:</p>
<pre>&lt;script language="JavaScript"&gt;
&lt;!--
...some code
//--&gt;
&lt;/script&gt;</pre>
<p>However, in 2010, all browsers (Even IE6, that means a lot) can interpret Javascript, so there&#8217;s absolutely no need to wrap code within comments anymore. Even worse, if code is wrapped within comments and use the decrement symbol <code>--</code>, you&#8217;ll expect some weird problems due to the fact the browser may think it&#8217;s the end of the html comment.</p>
<h2>Use a framework</h2>
<p>Unless your Javascript code is really short and easy, you should always avoid reinventing the wheel by using a framework of your choice. In my opinion, jQuery is the best and has an awesome community, so you should give it a try if you haven&#8217;t already.</p>
<h2>Always declare your variables using var</h2>
<p>You should introduce any variable you create with the <code>var</code> statement, otherwise it gets to the global scope. Also, using <code>var</code> makes your code more readable and self-explanatory.<br /> Example of variable created using the <code>var</code> statement:</p>
<pre>var name = "Jean";
var size = data.length;</pre>
<h2>Keep your code unobtrusive</h2>
<p>Some years ago, when a programmer wanted to add an event to an html element (for example, if you want to validate a date when the user typed something) he simply put Javascript code in the html, using a special attribute such as <code>onblur</code>, <code>onchange</code>, <code>onclick</code>, etc.<br /> Example:</p>
<pre>&lt;input type="text" name="date" onchange="validateDate()" /&gt;</pre>
<p>This works great, but it is a bit dirty. HTML should only contain the document description. Just like it&#8217;s bad practice to use inline CSS styles, it&#8217;s bad practice to use inline Javascript.</p>
<p>Instead, what about using some unobtrusive Javascript? Using jQuery, it is pretty easy to do, as you can see in the following example:</p>
<pre>$(document).ready(function(){
	$('input[name=date]').bind('change', validateDate);
});</pre>
<h2>Include your scripts at the bottom of your HTML files</h2>
<p>Not so long ago, it was generally considered good practice to insert your Javascript files within the <code>&lt;head&gt;</code> and <code>&lt;/head&gt;</code> tags of your html document.<br /> But browsers read html files from top to bottom, and load external files dynamically. Which mean that inserting scripts within the <code>&lt;head&gt;</code> and <code>&lt;/head&gt;</code> tags will make your Javascript load before some of the page content.<br /> In order to always load scripts after the content, Javascript files should always been included at the bottom of your html files, as shown below:</p>
<pre>    &lt;script src="myscript.js?" type="text/javascript"&gt;&lt;/script&gt;
  &lt;/body&gt;
&lt;/html&gt;</pre>
<h2>Use JSLint</h2>
<p><a href="http://www.jslint.com/">JSLint</a> is a web-app which takes a JavaScript source and scans it. If it finds a problem, it returns a message describing the problem and an approximate solution.<br /> JSLint is great to find bugs in your code, and also things that may be written in a better way. This site is definitely my favorite coding buddy when developing some Javascript.</p>
<h2>Don&#8217;t use document.write</h2>
<p>The good old <code>document.write</code> method has been deprecated for years, however it is still very common to see it while browsing code.</p>
<pre>document.write("hello world");</pre>
<p>Instead of using this deprecated method, you should use the DOM and the <code>innerHTML</code> function to insert text on a page:</p>
<pre>document.getElementById('hello').innerHTML('hello world');</pre>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/best-practices-for-modern-javascript-development">Best practices for modern Javascript development</a></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/aae75_1IjYKA0NgpU" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/best-practices-for-modern-javascript-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10 useful new WordPress hacks</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-new-wordpress-hacks/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-new-wordpress-hacks/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 13:43:10 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[cwc]]></category>
		<category><![CDATA[human time]]></category>
		<category><![CDATA[mail users]]></category>
		<category><![CDATA[php echo]]></category>
		<category><![CDATA[private site]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[timestamp]]></category>
		<category><![CDATA[unsubscribe option]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-new-wordpress-hacks/</guid>
		<description><![CDATA[Remove comments autolinks If someone leaves a comment containing a url, the url will be automatically transformed to a link by WordPress. This can be useful, but personally I don&#8217;t like to see many links in comments, especially when they&#8217;re a bit spammy. This is why I decided, on the latest CWC theme, to remove comments [...]]]></description>
			<content:encoded><![CDATA[<h2>Remove comments autolinks</h2>
<p>If someone leaves a comment containing a url, the url will be automatically transformed to a link by WordPress. This can be useful, but personally I don&#8217;t like to see many links in comments, especially when they&#8217;re a bit spammy.<br /> This is why I decided, on the latest CWC theme, to remove comments autolink. Doing so is pretty easy, just paste the following into your <em>functions.php</em> file. Once you saved the file, you&#8217;ll notice that autolinks have disappeared.</p>
<pre>remove_filter('comment_text', 'make_clickable', 9);</pre>
<p><strong>» Source: <a href="http://www.wprecipes.com/wordpress-hack-remove-autolinks-in-comments">http://www.wprecipes.com/wordpress-hack-remove-autolinks-in-comments</a></strong></p>
<h2>Automatically notify your users of new posts</h2>
<p>If you run a private site using WordPress, then it could be useful to notify your users when a new post is published. The following snippet will get all user emails from your database and will send an email to them automatically when a post is published.<br /> Of course, you shouldn&#8217;t use that code on your blog as it does not currently have any unsubscribe option.</p>
<pre>function email_members($post_ID)  {
    global $wpdb;
    $usersarray = $wpdb-&gt;get_results("SELECT user_email FROM $wpdb-&gt;users;");
    $users = implode(",", $usersarray);
    mail($users, "New WordPress recipe online!", 'A new recipe have been published on http://www.catswhocode.com');
    return $post_ID;
}

add_action('publish_post', 'email_members');</pre>
<h2>Twitter style &#8220;time ago&#8221; dates</h2>
<p>Displaying dates using the &#8220;5 days ago&#8221; format is becoming very popular on blogs, thanks to Twitter popularity.<br /> I have seen lots of complicated tutorials to use this format on your WordPress blog, however many people don&#8217;t know that WordPress has a built-in function to do the same thing: <code>human_time_diff()</code>.</p>
<p>Paste the snippet below anywhere within the loop, and it will display your dates using the &#8220;time ago&#8221; format.</p>
<pre>Posted &lt;?php echo human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ago'; ?&gt;</pre>
<p><strong>» Source: <a href="http://www.phpsnippets.info/display-dates-as-time-ago">http://www.phpsnippets.info/display-dates-as-time-ago</a></strong></p>
<h2>Display post thumbnail in your RSS feed</h2>
<p>Introduced in WordPress 2.9, the <code>the_post_thumbnail()</code> function is very useful to easily add and display a thumbnail attached to a post. Unfortunately, there&#8217;s no built-in way to display this thumbnail on your RSS feed.</p>
<p>Happily, the function below will solve this problem. Simply paste it in your <code>functions.php</code>, save it, and the post thumbnail will be automatically displayed on your RSS feed.</p>
<pre>function diw_post_thumbnail_feeds($content) {
	global $post;
	if(has_post_thumbnail($post-&gt;ID)) {
		$content = '&lt;div&gt;' . get_the_post_thumbnail($post-&gt;ID) . '&lt;/div&gt;' . $content;
	}
	return $content;
}
add_filter('the_excerpt_rss', 'diw_post_thumbnail_feeds');
add_filter('the_content_feed', 'diw_post_thumbnail_feeds');</pre>
<p><strong>» Source: <a href="http://digwp.com/2010/06/show-post-thumbnails-in-feeds/">http://digwp.com/2010/06/show-post-thumbnails-in-feeds/</a></strong></p>
<h2>Block external requests</h2>
<p>By default, WordPress does some external requests in order to get the available updates and the WordPress news shown in your dashboard. Personally, I don&#8217;t mind them, but I&#8217;ve recently had clients who didn&#8217;t wanted any external requests. So, I&#8217;ve blocked them using this interesting hack.<br /> Simply add the following line to your <code>wp-config.php</code> file:</p>
<pre>define('WP_HTTP_BLOCK_EXTERNAL', true);</pre>
<p>If you need to allow some external requests, it it easy to create a whitelist, as shown below:</p>
<pre>define('WP_ACCESSIBLE_HOSTS', 'rpc.pingomatic.com');</pre>
<p>This  line of code have to be pasted in <code>wp-config.php</code> as well.<br /> <strong>» Source: <a href="http://digwp.com/2010/08/pimp-your-wp-config-php/">http://digwp.com/2010/08/pimp-your-wp-config-php/</a></strong></p>
<h2>Easy debug mode</h2>
<p>When things go wrong, you can always use the super useful WordPress debug tool, <code>WP_DEBUG</code>. By default, you have to paste a line of code in your <code>wp-config.php</code> to make the debug mode available.<br /> By if you need to easily access the debug mode even when your site is live, you should edit your <code>wp-config.php</code> file and replace</p>
<pre>define('WP_DEBUG', true);</pre>
<p>by:</p>
<pre>if ( isset($_GET['debug']) &amp;&amp; $_GET['debug'] == 'debug')
  define('WP_DEBUG', true);</pre>
<p>Once done, simply add a GET parameter to the url of the page you&#8217;d like to debug, as shown below:</p>
<pre>http://www.catswhocode.com/blog/about?debug=debug</pre>
<p>Of course, for obvious security reasons you should replace the name debug by a random word of your choice so no one will ever see your site in debug mode.<br /> <strong>» Source: <a href="http://yoast.com/wordpress-debug/">http://yoast.com/wordpress-debug/</a></strong></p>
<h2>Use WordPress shortcode in theme files</h2>
<p>WordPress shortcodes are a super easy way to add content such as rss feeds, google maps, galleries and more into your posts or pages. But what about being able to output shortcodes in your theme files?<br /> A built-in function exists, but most people never heard of it. The function is called <code>do_shortcode()</code>. It takes one parameter, the shortcode you&#8217;d like to display. I&#8217;ve heard you can ad more than one shortcode as a parameter, but I haven&#8217;t tried it yet.</p>
<pre>do_shortcode('&#091;gallery]
');</pre>
<p><strong>» Source: <a href="http://codex.wordpress.org/Function_Reference/do_shortcode">http://codex.wordpress.org/Function_Reference/do_shortcode</a></strong></p>
<h2>Allow upload of more file types</h2>
<p>If you ever tried to upload some not so common filetypes, such as Textmate&#8217;s <code>.tmCommand</code> to your WordPress blog, you may have experienced an error, because WordPress simply doesn&#8217;t want you to upload some other file type.<br /> Fortunately, you can add new file types to WordPress whitelist. Doing so is quite easy, just paste the following piece of code in your <code>functions.php</code>, and you&#8217;re done.<br /> Note that file types have to be separated by a pipe.</p>
<pre>function addUploadMimes($mimes) {
    $mimes = array_merge($mimes, array(
        'tmbundle|tmCommand|tmDragCommand|tmSnippet|tmLanguage|tmPreferences' =&gt; 'application/octet-stream'
    ));

    return $mimes;
}

add_filter('upload_mimes', 'addUploadMimes');</pre>
<p><strong>» Source: <a href="http://www.wprecipes.com/wordpress-tip-allow-upload-of-more-file-types">http://www.wprecipes.com/wordpress-tip-allow-upload-of-more-file-types</a></strong></p>
<h2>Google Docs PDF viewer shortcode</h2>
<p>Google Docs is definitely the easiest way to read documents in .pdf, .doc or .xls online. So, if you want to share a PDF file with your readers, what about creating a shortcode that will open the PDF in Google Docs instead of forcing download?</p>
<p>Simply paste the code in your <code>functions.php</code>.</p>
<pre>function pdflink($attr, $content) {
	return '&lt;a class="pdf" href="http://docs.google.com/viewer?url=' . $attr['href'] . '"&gt;'.$content.'&lt;/a&gt;';
}
add_shortcode('pdf', 'pdflink');</pre>
<p>Once you saved the file, you&#8217;ll be able to use the shortcode on your posts and page. Here is the syntax:</p>
<pre>[pdf href="http://yoursite.com/linktoyour/file.pdf"]View PDF[/pdf]</pre>
<p><strong>» Source: <a href="http://www.wprecipes.com/wordpress-tip-create-a-pdf-viewer-shortcode">http://www.wprecipes.com/wordpress-tip-create-a-pdf-viewer-shortcode</a></strong></p>
<h2>Detect the visitor browser within WordPress</h2>
<p>Well, this hack is not so new, but it still remains one of my favorites. What this code does is pretty simple, it detects the name of the visitor browser and adds it to the <code>body_class()</code> function.<br /> That way, you can correct browser-specific problems extremely easily. The function has to be pasted in your <code>functions.php</code> file.</p>
<pre>add_filter('body_class','browser_body_class');
function browser_body_class($classes) {
	global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;

	if($is_lynx) $classes[] = 'lynx';
	elseif($is_gecko) $classes[] = 'gecko';
	elseif($is_opera) $classes[] = 'opera';
	elseif($is_NS4) $classes[] = 'ns4';
	elseif($is_safari) $classes[] = 'safari';
	elseif($is_chrome) $classes[] = 'chrome';
	elseif($is_IE) $classes[] = 'ie';
	else $classes[] = 'unknown';

	if($is_iphone) $classes[] = 'iphone';
	return $classes;
}</pre>
<p>The function output will look like:</p>
<pre>&lt;body class="home blog logged-in safari"&gt;</pre>
<p><strong>» Source: <a href="http://www.nathanrice.net/blog/browser-detection-and-the-body_class-function/">http://www.nathanrice.net/blog/browser-detection-and-the-body_class-function/</a></strong></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/10-useful-new-wordpress-hacks">10 useful new WordPress hacks</a></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/9f3db_F7rIkClcJsw" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-new-wordpress-hacks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Top 10 CSS3 buttons tutorials</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/top-10-css3-buttons-tutorials/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/top-10-css3-buttons-tutorials/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 13:42:04 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Aqua]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[gradient]]></category>
		<category><![CDATA[gradients]]></category>
		<category><![CDATA[Images]]></category>
		<category><![CDATA[toggle buttons]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/top-10-css3-buttons-tutorials/</guid>
		<description><![CDATA[Super Awesome Buttons with CSS3 and RGBA &#187; View tutorial Your own Google buttons using CSS3 &#187; View tutorial CSS3 Gradient Buttons &#187; View tutorial Kick-Ass CSS3 Button &#187; View tutorial Pure CSS3 icons &#187; View tutorial Extremely fancy CSS3 buttons &#187; View tutorial BonBon: Sweet CSS3 buttons &#187; View tutorial Realistic Looking CSS3 Buttons [...]]]></description>
			<content:encoded><![CDATA[<h2>Super Awesome Buttons with CSS3 and RGBA</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/4d794_super-awesome-button-css3.jpg" alt="" /><br /> <strong>&raquo; <a href="http://www.zurb.com/article/266/super-awesome-buttons-with-css3-and-rgba">View tutorial</a></strong></p>
<h2>Your own Google buttons using CSS3</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/4d794_css3-google-buttons.jpg" alt="" /><br /> <strong>&raquo; <a href="http://www.zurb.com/playground/google-buttons">View tutorial</a></strong></p>
<h2>CSS3 Gradient Buttons</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/e37c5_css3-gradient-buttons.jpg" alt="" /><br /> <strong>&raquo; <a href="http://www.webdesignerwall.com/tutorials/css3-gradient-buttons/">View tutorial</a></strong></p>
<h2>Kick-Ass CSS3 Button</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/0c873_kick-ass-css3-button.jpg" alt="" /><br /> <strong>&raquo; <a href="http://net.tutsplus.com/tutorials/html-css-techniques/build-kick-ass-practical-css3-buttons/">View tutorial</a></strong></p>
<h2>Pure CSS3 icons</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/0c873_css3-icons.jpg" alt="" /><br /> <strong>&raquo; <a href="http://nicolasgallagher.com/pure-css-social-media-icons/">View tutorial</a></strong></p>
<h2>Extremely fancy CSS3 buttons</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/7f56a_extremely-fancy-css3-buttons.jpg" alt="" /><br /> <strong>&raquo; <a href="http://technology.posterous.com/make-css3-buttons-that-are-extremely-fancy">View tutorial</a></strong></p>
<h2>BonBon: Sweet CSS3 buttons</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/7f56a_css3-bonbon.jpg" alt="" /><br /> <strong>&raquo; <a href="http://lab.simurai.com/css/buttons/">View tutorial</a></strong></p>
<h2>Realistic Looking CSS3 Buttons</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/30c0d_realistic-css3-buttons.jpg" alt="" /><br /> <strong>&raquo; <a href="http://somadesign.ca/2010/realistic-looking-css3-buttons/">View tutorial</a></strong></p>
<h2>CSS3 &#8220;Aqua&#8221; buttons with no images</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/30c0d_aqua-buttons-css3.jpg" alt="" /><br /> <strong>&raquo; <a href="http://girliemac.com/blog/2009/04/30/css3-gradients-no-image-aqua-button/">View tutorial</a></strong></p>
<h2>Flexible CSS3 toggle buttons</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/147d1_css3-toggle-buttons.jpg" alt="" /><br /> <strong>&raquo; <a href="http://blog.seanmartell.com/2009/04/21/css3-flexible-ui-avoid-recutting-ui-graphics-for-mobile/">View tutorial</a></strong></p>
<h2>Building beautiful buttons with css gradients</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/147d1_beautiful-button-gradient.jpg" alt="" /><br /> <strong>&raquo; <a href="http://hacks.mozilla.org/2009/11/building-beautiful-buttons-with-css-gradients/">View tutorial</a></strong></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/top-10-css3-buttons-tutorials">Top 10 CSS3 buttons tutorials</a></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/147d1_c8NMRLNO38M" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/top-10-css3-buttons-tutorials/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enhance your web forms with new HTML5 features</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/enhance-your-web-forms-with-new-html5-features/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/enhance-your-web-forms-with-new-html5-features/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 13:40:27 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[firstname]]></category>
		<category><![CDATA[input field]]></category>
		<category><![CDATA[input name]]></category>
		<category><![CDATA[input type text]]></category>
		<category><![CDATA[message saying that]]></category>
		<category><![CDATA[placeholder text]]></category>
		<category><![CDATA[search engines]]></category>
		<category><![CDATA[web forms]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/enhance-your-web-forms-with-new-html5-features/</guid>
		<description><![CDATA[Please note that HTML5 is an emerging technique. These examples are not intended for use on a production site. Results may vary according to browser implementation. Please use Chrome or Safari for best results. Required fields Whose ever tried to submit a form and gotten an error message saying that you &#8220;forgot&#8221; to enter your [...]]]></description>
			<content:encoded><![CDATA[<p>Please note that HTML5 is an emerging technique. These examples are not intended for use on a production site. Results may vary according to browser implementation. Please use Chrome or Safari for best results.</p>
<h2>Required fields</h2>
<p>Whose ever tried to submit a form and gotten an error message saying that you &#8220;forgot&#8221; to enter your email address? Probably not a lot of us: In fact, 99 percent of all web forms have at least one field marked as required.</p>
<p>In good ol&#8217; HTML, we had to manually display that a specific field is required, most of the time by using a red asterisk. But with HTML5, you can set up a input field to be required:</p>
<pre>&lt;input type="text"  name="client_name" required&gt;</pre>
<p>And on the CSS side, something like</p>
<pre>input:required {
    border: 1px red solid;
}</pre>
<p>will save you a lot of time.</p>
<p>Two similar attributes are also available: <code>optional</code> and <code>invalid</code>. They work exactly as the <code>required</code> attribute explained above.</p>
<h2>Placeholders</h2>
<p>In a form, an input field always has a label explaining what kind of information is required. While you can currently use the <code>label</code> tag to display a label for a specific text field, HTML5 introduces the <code>placeholder</code> attribute. As shown below, using it is pretty simple:</p>
<pre>&lt;input name="firstname" placeholder="Please enter your first name"&gt;</pre>
<p>The HTML5 <code>placeholder</code> attribute works exactly as the <code>value</code> attribute, except that when the user click on the text field, the placeholder text is automatically removed so the user can easily enter his information.</p>
<p>The placeholder attribute currently works only in safari/webkit. Don&#8217;t worry about other browsers though, it is pretty easy to simulate placeholders using javascript:</p>
<h2>Autofocus</h2>
<p>A new HTML5 attribute is named <code>autofocus</code>. If applied to an element, the element will automatically receive the focus once the page is loaded. This can be seen on some sites and most search engines.</p>
<p>Nothing complicated, just use the syntax below, and <strong>remember that in HTML5, there&#8217;s no more need for attributes to have a value like in XHTML 1.0</strong>.</p>
<pre>&lt;input name="search" autofocus&gt;</pre>
<h2>Email fields</h2>
<p>Asking someone&#8217;s email on a web form is extremely common because email is still the easiest way to contact someone over the internet. HTML5 introduces a new type for the input element, named <code>email</code>.</p>
<pre>&lt;input name="email" type="email"&gt;</pre>
<h2>Pattern attribute</h2>
<p>When validating a web form, we have to validate the data entered by the visitor. The new <code>pattern</code> HTML5 attribute allows you to define a regular expression pattern. Only the data that matches the defined pattern will be validated. If the data doesn&#8217;t match the pattern, then the form will not be submitted.</p>
<p>This is, in my opinion, an extremely good thing, which will save lots of time to developers when coding forms. Though, remember that you should always validate data on the server side as well.</p>
<pre>&lt;input type="text" name="Phone" pattern="^0[1-689][0-9]{8}$" placeholder="Phone" required&gt;</pre>
<h2>Url fields</h2>
<p>Nowadays, many people have a website, blog, or at least a <a href="http://www.twitter.com/catswhocode">Twitter profile</a>. This is why many web forms offer the possibility to enter an url.</p>
<p>HTML5 introduces a new type for the <code>input</code> element, designed specifically for entering urls:</p>
<pre>&lt;input name="url" type="url"&gt;</pre>
<p>Although I didn&#8217;t test it myself, I heard that the W3C validator will raise an error if the value of a url field doesn&#8217;t match a proper url structure.</p>
<h2>Date pickers</h2>
<p>Many businesses are offering an appointment request through their website. In that case, the visitor has to specify the day they would like an appointment. HTML5 introduces the <code>date</code> type for the <code>input</code> element:</p>
<pre>&lt;input name="day" type="date"&gt;</pre>
<p>When clicked, the <code>date</code> attribute will display a date picker so visitors will simply have to choose a date instead of entering it manually. Unfortunately, except in Opera, most browsers don&#8217;t have it implemented yet.</p>
<p>Note that a date picker can be implemented on your forms using the following types:</p>
<pre>&lt;input type="date"&gt;
&lt;input type="datetime"&gt;
&lt;input type="month"&gt;
&lt;input type="week"&gt;
&lt;input type="time"&gt;</pre>
<p>Isn&#8217;t that user friendly? Personally, I can&#8217;t wait to implement this in my forms but as I said earlier this isn&#8217;t very well implemented in browsers at the time of writing this post. Of course, Javascript is always here to help. On <a href="http://www.unchi.co.uk/2010/05/17/html5-date-picker-with-fallback/">this site</a> I found a simple fallback implementation for the <code>input type=date</code> HTML5 attribute:</p>
<pre>var i = document.createElement("input");
i.setAttribute("type", "date");
if (i.type == "text") {
    // No HTML5 native date picker support, use jQuery or your favorite framework to create one.
}</pre>
<h2>Search boxes</h2>
<p>To enhance ease of retrieving information, many websites have implemented their own search engine. HTML5 has created a new type for search fields.</p>
<pre>&lt;input name="q" type="search"&gt;</pre>
<p>For now, the only difference with regular text inputs is that, if you use Safari, the search box will have rounded corners. But maybe interesting functionalities will be implemented in the future. Let&#8217;s hope, because right now I have to admit that I don&#8217;t really see why we should use this type.</p>
<h2>Sliders type and step attribute</h2>
<p>HTML5 is also introducing sliders: A new type for the input element, which allows visitors to easily select a number instead of entering it manually.</p>
<pre>&lt;input name="number" type="range" min="0" max="10"&gt;</pre>
<p>The example above allows the visitor to choose a number between 0 and 10. If you want the slider to be incremented/decremented 2 by 2, you&#8217;ll have to use one more new attribute: step. Here is an example:</p>
<pre>&lt;input name="number" type="range" min="0" max="10" step="2" &gt;</pre>
<p>That way, visitors will only be able to select numbers like 0, 2, 4, and so on.</p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/enhance-your-web-forms-with-new-html5features">Enhance your web forms with new HTML5 features</a></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/037b4_8AAnkp4Th2o" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/enhance-your-web-forms-with-new-html5-features/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to easily create charts using jQuery and HTML5</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-easily-create-charts-using-jquery-and-html5/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-easily-create-charts-using-jquery-and-html5/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 13:40:17 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[css files]]></category>
		<category><![CDATA[doctype html]]></category>
		<category><![CDATA[html document]]></category>
		<category><![CDATA[html structure]]></category>
		<category><![CDATA[html table]]></category>
		<category><![CDATA[javascript files]]></category>
		<category><![CDATA[th scope]]></category>
		<category><![CDATA[thead]]></category>
		<category><![CDATA[utf 8]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-easily-create-charts-using-jquery-and-html5/</guid>
		<description><![CDATA[Step 1: Preparing files Here we go! The first thing to do is obviously to create a directory on your Mac (or PC, nobody&#8217;s perfect ). You should name it chart for example. Once done, download the required Javascript and CSS files and save it on your hard drive. Now, create a new html document, [...]]]></description>
			<content:encoded><![CDATA[<h2>Step 1: Preparing files</h2>
<p>Here we go! The first thing to do is obviously to create a directory on your Mac (or PC, nobody&#8217;s perfect <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/265b1_icon_wink.gif" alt=";)" class="wp-smiley" /> ). You should name it <em>chart</em> for example. Once done, <a href="http://code.google.com/p/dwpe/downloads/list">download the required Javascript and CSS files</a> and save it on your hard drive.</p>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/949ba_chart.png" alt="" /></p>
<p>Now, create a new html document, named <em>charts.html</em>.  Copy the html structure below, and paste it into your newly created <em>charts.html</em> file.</p>
<pre>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
	&lt;meta http-equiv="content-type" content="text/html;charset=UTF-8" /&gt;
	&lt;title&gt;Charts!&lt;/title&gt;       

&lt;/head&gt;

&lt;body&gt;

&lt;/body&gt;
&lt;/html&gt;</pre>
<p>Did you notice that I used the &lt;!DOCTYPE html&gt; doctype? It is the right doctype to use, as the javscript code we&#8217;ll add later will turn a html table into a HTML 5 canvas.</p>
<h2>Step 2: Adding data</h2>
<p>Now that we downloaded the javascript files and created an html document, it&#8217;s time to add data. Copy the code below and paste it within the &lt;<em>body&gt;</em> and <em>&lt;/body&gt;</em> tags of your <em>charts.html</em> file.</p>
<pre>&lt;table&gt;
	&lt;caption&gt;Visits from August 16 to August 21&lt;/caption&gt;
	&lt;thead&gt;
		&lt;tr&gt;
			&lt;td&gt;&lt;/td&gt;
			&lt;th scope="col"&gt;Monday&lt;/th&gt;
			&lt;th scope="col"&gt;Tuesday&lt;/th&gt;
			&lt;th scope="col"&gt;Wednesday&lt;/th&gt;
			&lt;th scope="col"&gt;Thursday&lt;/th&gt;
			&lt;th scope="col"&gt;Friday&lt;/th&gt;
			&lt;th scope="col"&gt;Saturday&lt;/th&gt;
			&lt;th scope="col"&gt;Sunday&lt;/th&gt;
		&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;

		&lt;tr&gt;
			&lt;th scope="row"&gt;CatsWhoCode.com&lt;/th&gt;
			&lt;td&gt;12541&lt;/td&gt;
			&lt;td&gt;11204&lt;/td&gt;
			&lt;td&gt;11354&lt;/td&gt;
			&lt;td&gt;10058&lt;/td&gt;
			&lt;td&gt;9871&lt;/td&gt;
			&lt;td&gt;8254&lt;/td&gt;
			&lt;td&gt;5477&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th scope="row"&gt;WpRecipes.com&lt;/th&gt;
			&lt;td&gt;9855&lt;/td&gt;
			&lt;td&gt;8870&lt;/td&gt;
			&lt;td&gt;8731&lt;/td&gt;
			&lt;td&gt;7488&lt;/td&gt;
			&lt;td&gt;8159&lt;/td&gt;
			&lt;td&gt;6547&lt;/td&gt;
			&lt;td&gt;4512&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;th scope="row"&gt;CatsWhoBlog.com&lt;/th&gt;
			&lt;td&gt;3241&lt;/td&gt;
			&lt;td&gt;2544&lt;/td&gt;
			&lt;td&gt;2597&lt;/td&gt;
			&lt;td&gt;3108&lt;/td&gt;
			&lt;td&gt;2114&lt;/td&gt;
			&lt;td&gt;2045&lt;/td&gt;
			&lt;td&gt;950&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;</pre>
<p>Of course, feel free to add your own data to make the example more interesting for you.</p>
<h2>Step 3: Let the magic happen</h2>
<p>Alright, now we have a bunch of downloaded files and an html document. It&#8217;s time to merge them all together and finally generate the chart.<br /> Unzip the downloaded file and open the extracted directory. Copy the following files into your <em>chart</em> directory.</p>
<ul>
<li>charting/css/basic.css</li>
<li>charting/css/visualize.css</li>
<li>charting/css/visualize-light.css</li>
<li>charting/js/visualize.js</li>
</ul>
<p>Once done, we obviously have to link the css and javascript files to our document. Paste the following after the &lt;title&gt; tag of the document:</p>
<pre>&lt;link href="basic.css" type="text/css" rel="stylesheet" /&gt;
&lt;link href="visualize.css" type="text/css" rel="stylesheet" /&gt;
&lt;link href="visualize-light.css" type="text/css" rel="stylesheet" /&gt;
&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="visualize.js"&gt;&lt;/script&gt;</pre>
<p>It&#8217;s time to give life to our chart. Paste the final piece of code after the script calls:</p>
<pre>&lt;script type="text/javascript"&gt;
	$(function(){
		$('table').visualize();
	});
&lt;/script&gt;</pre>
<p>Once you saved the file, your HTML table should be displayed along with a good looking chart. If you don&#8217;t want the table to be visible, simply hide it using the <em>display:none</em> css property.</p>
<h2>Additional explanations</h2>
<p>Generating bar charts is definitely great, but what if your preference goes to a pie chart? No problem, visualize.js allows 4 different type of charts: Bar, area, pie and line.</p>
<p>Changing the default type is pretty easy: Just add the type parameter as shown below:</p>
<pre>$('table').visualize({type: 'pie'});</pre>
<p>Cool, isn&#8217;t it? Visualize.js accepts even more parameters to make sure your chart will look exactly how you want. Here are the parameters which can be used:</p>
<ul>
<li><strong>type:</strong> <em>string</em>. Accepts &#8216;bar&#8217;, &#8216;area&#8217;, &#8216;pie&#8217;, &#8216;line&#8217;. Default: &#8216;bar&#8217;.</li>
<li><strong>width:</strong> <em>number</em>. Width of chart. Defaults to table width</li>
<li><strong>height:</strong> <em>number</em>. Height of chart. Defaults to table height</li>
<li><strong>appendTitle:</strong> <em>boolean</em>. Add title to chart. Default: true.</li>
<li><strong>title:</strong> <em>string</em>. Title for chart. Defaults to text of table&#8217;s Caption element.</li>
<li><strong>appendKey:</strong> <em>boolean</em>. Adds the color key to the chart. Default: true.</li>
<li><strong>colors:</strong> <em>array</em>. Array items are hex values, used in order of appearance. Default: ['#be1e2d','#666699','#92d5ea','#ee8310','#8d10ee','#5a3b16','#26a4ed','#f45a90','#e9e744']</li>
<li><strong>textColors:</strong> <em>array</em>. Array items are hex values. Each item corresponds with colors array. null/undefined items will fall back to CSS text color. Default: [].</li>
<li><strong>parseDirection:</strong> <em>string</em>. Direction to parse the table data. Accepts &#8216;x&#8217; and &#8216;y&#8217;. Default: &#8216;x&#8217;.</li>
<li><strong>pieMargin:</strong> <em>number</em>. Space around outer circle of Pie chart. Default: 20.</li>
<li><strong>pieLabelPos:</strong> <em>string</em>. Position of text labels in Pie chart. Accepts &#8216;inside&#8217; and &#8216;outside&#8217;. Default: &#8216;inside&#8217;.</li>
<li><strong>lineWeight:</strong> <em>number</em>. Stroke weight for lines in line and area charts. Default: 4.</li>
<li><strong>barGroupMargin:</strong> <em>number</em>. Space around each group of bars in a bar chart. Default: 10.</li>
<li><strong>barMargin:</strong> number. Creates space around bars in bar chart (added to both sides of each bar). Default: 1</li>
</ul>
<p>That&#8217;s all for today. Have fun with the charts <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/aa7e5_icon_smile.gif" alt=":)" class="wp-smiley" /></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/how-to-easily-create-charts-using-jquery-and-html5">How to easily create charts using jQuery and HTML5</a></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/aa7e5_pSyeP4d84as" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-easily-create-charts-using-jquery-and-html5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>8 examples of stunning CSS3 text effects</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-examples-of-stunning-css3-text-effects/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-examples-of-stunning-css3-text-effects/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 13:38:57 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[article view]]></category>
		<category><![CDATA[british web]]></category>
		<category><![CDATA[css text]]></category>
		<category><![CDATA[inset]]></category>
		<category><![CDATA[snook]]></category>
		<category><![CDATA[spooner]]></category>
		<category><![CDATA[text effects]]></category>
		<category><![CDATA[text shadow]]></category>
		<category><![CDATA[web developers]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-examples-of-stunning-css3-text-effects/</guid>
		<description><![CDATA[How to Create Inset Typography with CSS3 Just two years ago, we all used Photoshop to create beautiful inset typography. Now, you can do it using only CSS3. This great tutorial will help you getting started. View tutorial: http://sixrevisions.com/css/how-to-create-inset-typography-with-css3/ Create Beautiful CSS3 Typography Technically speaking, styling text is very simple. The hard part is the [...]]]></description>
			<content:encoded><![CDATA[<h2>How to Create Inset Typography with CSS3</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/c14c6_1.jpg" alt="" /><br /> Just two years ago, we all used Photoshop to create beautiful inset typography. Now, you can do it using only CSS3. This great tutorial will help you getting started.<br /> <strong>View tutorial: <a href="http://sixrevisions.com/css/how-to-create-inset-typography-with-css3/">http://sixrevisions.com/css/how-to-create-inset-typography-with-css3/</a></strong></p>
<h2>Create Beautiful CSS3 Typography</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/be135_2.jpg" alt="" /><br /> Technically speaking, styling text is very simple. The hard part is the artistic part: How to make text easy to read and look good? This is the focus of the tutorial, which is a must read for all web developers and designers.<br /> <strong>View tutorial: <a href="http://blog.echoenduring.com/2010/05/13/create-beautiful-css3-typography/">http://blog.echoenduring.com/2010/05/13/create-beautiful-css3-typography/</a></strong></p>
<h2>Create a Letterpress Effect with CSS Text-Shadow</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/5542f_3.jpg" alt="" /><br /> The &#8220;letterpress&#8221; effect is very popular in web design. Many people do it using Photoshop, but you can do it extremely easily using CSS3 only. How? Chris Spooner shows you how in this interesting article.<br /> <strong>View tutorial: <a href="http://line25.com/tutorials/create-a-letterpress-effect-with-css-text-shadow">http://line25.com/tutorials/create-a-letterpress-effect-with-css-text-shadow</a></strong></p>
<h2>How to Create a Cool Anaglyphic Text Effect with CSS</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/5542f_4.jpg" alt="" /><br /> Chris Spooner again! This time, the talented British web designer comes back with a tutorial showing you how you can create a anaglyphic effect with CSS. Not sure I&#8217;ll use it on a live site, but it&#8217;s always interesting to know how to do it.<br /> <strong>View tutorial: <a href="http://line25.com/tutorials/how-to-create-a-cool-anaglyphic-text-effect-with-css">http://line25.com/tutorials/how-to-create-a-cool-anaglyphic-text-effect-with-css</a></strong></p>
<h2>Text Rotation with CSS</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/5542f_6.jpg" alt="" /><br /> Why should text always be displayed horizontally? CSS3 has the <em>transform: rotate</em> property, which allow you to rotate any elements, including text. The following tutorial, written by Jonathan Snook, will show how in details how to achieve an awesome rotated text effect.<br /> <strong>View tutorial: <a href="http://snook.ca/archives/html_and_css/css-text-rotation">http://snook.ca/archives/html_and_css/css-text-rotation</a></strong></p>
<h2>Text Embossing Technique With CSS</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/6d525_5.jpg" alt="" /><br /> One more technique I&#8217;ve done exclusively in photoshop in the past. Thanks to CSS3, I&#8217;m now able to do it entirely in CSS.<br /> <strong>View tutorial: <a href="http://www.reynoldsftw.com/2009/03/text-embossing-technique-with-css/">http://www.reynoldsftw.com/2009/03/text-embossing-technique-with-css/</a></strong></p>
<h2>Adding an outline to your text using the CSS3 text-stroke property</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/58143_7.jpg" alt="" /><br /> Although this technique only works in webkit for now, I must admit that I really love it. You can add an outline to text, and even better, use transparent text with a solid outline.<br /> <strong>View tutorial: <a href="http://www.cardeo.ca/2010/adding-an-outline-to-your-text-using-the-css3-text-stroke-property">http://www.cardeo.ca/2010/adding-an-outline-to-your-text-using-the-css3-text-stroke-property</a></strong></p>
<h2>CSS textured text</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/58143_8.jpg" alt="" /><br /> Ok, this isn&#8217;t new, and this isn&#8217;t CSS3, but this example is so great that I can&#8217;t not feature it on this post. Nick La from WebDesignerWall explains how you can make gradients or textured texts using CSS.<br /> <strong>View tutorial: <a href="http://www.webdesignerwall.com/tutorials/css-gradient-text-effect/">http://www.webdesignerwall.com/tutorials/css-gradient-text-effect/</a></strong></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/8-examples-of-stunning-css3-text-effects">8 examples of stunning CSS3 text effects</a></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/38098_4aodForQ02M" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-examples-of-stunning-css3-text-effects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>8 CSS preprocessors to speed up development time</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-css-preprocessors-to-speed-up-development-time/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-css-preprocessors-to-speed-up-development-time/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 13:37:19 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[browser issues]]></category>
		<category><![CDATA[caching system]]></category>
		<category><![CDATA[color mixing]]></category>
		<category><![CDATA[command line tool]]></category>
		<category><![CDATA[css file]]></category>
		<category><![CDATA[development time]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[php projects]]></category>
		<category><![CDATA[ruby programming]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-css-preprocessors-to-speed-up-development-time/</guid>
		<description><![CDATA[Less CSS Less is probably the most well known CSS preprocessor. It allow a simplified syntax and the use of variables. Less CSS is for the Ruby programming language, however it looks like Aaron Russel created an extension for creating cached stylesheets your PHP projects can use. Get it: http://lesscss.org Sass On their website, Sass [...]]]></description>
			<content:encoded><![CDATA[<h2>Less CSS</h2>
<p>Less is probably the most well known CSS preprocessor. It allow a simplified syntax and the use of variables. Less CSS is for the Ruby programming language, however it looks like Aaron Russel created <a href="http://github.com/aaronrussell/less_php_cacher">an extension</a> for creating cached stylesheets your PHP projects can use.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/b3755_lesscss.png" alt="" /><br /> <strong>Get it: <a href="http://lesscss.org/">http://lesscss.org</a></strong></p>
<h2>Sass</h2>
<p>On their website, Sass claims to make CSS fun again. To be honest, I must admit that what this project is capable of is very interesting. Like Less CSS, it allow the use of variables and have a simplified syntax. Sass is definitely a great tool, unfortunely only available for Ruby, as far as I know.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/b3755_sass.png" alt="" /><br /> <strong>Get it: <a href="http://sass-lang.com/">http://sass-lang.com/</a></strong></p>
<h2>Turbine</h2>
<p>If like me, you&#8217;re a <a href="http://www.phpsnippets.info">PHP Lover</a>, here is a css preprocessor made for your favorite language. I haven&#8217;t tested it yet, but Turbine looks very cool. It allow a minimal syntax, automatically gzip multiple css, fix cross-browser issues, and a lot more. A must check if you&#8217;re into PHP.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/041c2_turbine.png" alt="" /><br /> <strong>Get it: <a href="http://turbine.peterkroener.de/index.php">http://turbine.peterkroener.de/index.php</a></strong></p>
<h2>Switch CSS</h2>
<p>Switch is a full featured, production ready CSS preprocessor. It runs under Apache with mod_python, or as an environment-agnostic command line tool.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/041c2_switchcss.png" alt="" /><br /> <strong>Get it: <a href="http://sourceforge.net/projects/switchcss/">http://sourceforge.net/projects/switchcss/</a></strong></p>
<h2>CSS Cacheer</h2>
<p>CSS Cacheer is a very cool preprocessor which allows developers to create plugins. It requires PHP and Apache with mod_deflate and mod_rewrite in order to work.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/041c2_csscacheer.png" alt="" /><br /> <strong>Get it: <a href="http://retired.haveamint.com/archive/2008/05/30/check_out_css_cacheer">http://retired.haveamint.com/archive/2008/05/30/check_out_css_cacheer</a></strong></p>
<h2>CSS Preprocessor</h2>
<p>Another interesting preprocessor, written in PHP 5. Among other things, this tool allow you to use expressions such as <em>margin-left: (200px * 3/2 – 10px);</em> in your stylesheets.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/cc2bf_csspreprocessor.png" alt="" /><br /> <strong>Get it: <a href="http://pornel.net/css">http://pornel.net/css</a></strong></p>
<h2>DT CSS</h2>
<p>DtCSS speeds up CSS coding by extending the features to CSS. Such as nested selectors, color mixing and more. DtCSS reads the CSS file with special syntax written for DtCSS, and outputs the standard CSS. It also comes with a smart caching system.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/0a147_dtcss.png" alt="" /><br /> <strong>Get it: <a href="http://code.google.com/p/dtcss/">http://code.google.com/p/dtcss/</a></strong></p>
<h2>CSS PP</h2>
<p>Unfortunely, CSS PP is still in alpha status, but the authors says the code will be released very soon. One of the good points of this projects is that it will be available in PHP, Python and Ruby. Great news for developpers who work with all of these languages.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/60383_csspp.png" alt="" /><br /> <strong>Get it: <a href="http://csspp.org/">http://csspp.org/</a></strong></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/8-css-preprocessors-to-speed-up-development-time">8 CSS preprocessors to speed up development time</a></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/60383_QfViSWPQDNk" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-css-preprocessors-to-speed-up-development-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: How to insert data programmatically</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/wordpress-how-to-insert-data-programmatically/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/wordpress-how-to-insert-data-programmatically/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 14:58:01 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[author author]]></category>
		<category><![CDATA[author id]]></category>
		<category><![CDATA[closer look]]></category>
		<category><![CDATA[gecko]]></category>
		<category><![CDATA[global user]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[rv]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/wordpress-how-to-insert-data-programmatically/</guid>
		<description><![CDATA[Inserting posts Do you remember back in 2008, when I created WP Vote? This site was the first (as far as I know) social voting site created 100% within WordPress. Users were able to submit a story, which was automatically published on the blog. Inserting a post programmatically in WordPress is extremely easy. You have [...]]]></description>
			<content:encoded><![CDATA[<h2>Inserting posts</h2>
<p>Do you remember back in 2008, when I created WP Vote? This site was the first (as far as I know) social voting site created 100% within WordPress. Users were able to submit a story, which was automatically published on the blog.</p>
<p>Inserting a post programmatically in WordPress is extremely easy. You have to use the wp_insert_post() function, which takes an array as a parameter.<br /> Here is a working example. If you want to test it, paste the code below on your <em>functions.php</em> file.</p>
<pre>global $user_ID;
$new_post = array(
    'post_title' =&gt; 'My New Post',
    'post_content' =&gt; 'Lorem ipsum dolor sit amet...',
    'post_status' =&gt; 'publish',
    'post_date' =&gt; date('Y-m-d H:i:s'),
    'post_author' =&gt; $user_ID,
    'post_type' =&gt; 'post',
    'post_category' =&gt; array(0)
);
$post_id = wp_insert_post($new_post);</pre>
<p>Cool, isn&#8217;t it? Let have a closer look to the parameters specified in the <em>$new_post</em> array:</p>
<ul>
<li><strong>post_title</strong>: the name of the post.</li>
<li><strong>post_content</strong>: the content of the post</li>
<li><strong>post_status</strong>: the post status (published, draft, etc)</li>
<li><strong>post_date</strong>: use date() or specify a custom date</li>
<li><strong>post_author</strong>: Author id of the post author</li>
<li><strong>post_type</strong>: Can be post, page, or a custom post type</li>
<li><strong>post_category</strong> An array of categories ids</li>
</ul>
<p><strong>Source: <a href="http://www.webmaster-source.com/2010/02/09/programmatically-creating-posts-in-wordpress">http://www.webmaster-source.com/2010/02/09/programmatically-creating-posts-in-wordpress</a></strong></p>
<h2>Inserting comments</h2>
<p>Inserting comments is not harder than inserting posts. I personally never used this code, but here is it in case you need it. To give it a try, simply paste it in your <em>functions.php</em> file.</p>
<pre>$data = array(
	'comment_post_ID' =&gt; 1,
	'comment_author' =&gt; 'admin',
	'comment_author_email' =&gt; 'admin@admin.com',
	'comment_author_url' =&gt; 'http://www.catswhocode.com',
	'comment_content' =&gt; 'Lorem ipsum dolor sit amet...',
	'comment_author_IP' =&gt; '127.0.0.1',
	'comment_agent' =&gt; 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; fr; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3',
	'comment_date' =&gt; date('Y-m-d H:i:s'),
	'comment_date_gmt' =&gt; date('Y-m-d H:i:s'),
	'comment_approved' =&gt; 1,
);

$comment_id = wp_insert_comment($data);</pre>
<p>Just like the wp_insert_post() function, wp_insert_comment() takes an array as a parameter. Here are the data used:</p>
<ul>
<li><strong>comment_post_ID</strong>: ID of the commented post</li>
<li><strong>comment_author</strong>: Name of the comment author</li>
<li><strong>comment_author_email</strong>: Email address of the comment author</li>
<li><strong>comment_author_url</strong>: Website of the comment author</li>
<li><strong>comment_content</strong>: Text of the comment</li>
<li><strong>comment_author_IP</strong>: IP address of the comment author</li>
<li><strong>comment_agent</strong>: User agent of the commenter browser</li>
<li><strong>comment_date</strong>: Date of the comment</li>
<li><strong>comment_date_gmt</strong>: GMT date of the comment</li>
<li><strong>comment_approved</strong>: Is the comment approved? 1 for yes and 0 for &#8220;awaiting moderation&#8221;</li>
</ul>
<h2>Adding categories to a post</h2>
<p>Now that we saw how to insert a post or a comment into WordPress database, let&#8217;s see how to make a post part of one (or more) categories. WordPress has a built-in function for that, named <em>wp_set_object_terms()</em>.</p>
<p>What you have to do is to create an array with the desired categories ID, and then use the function as shown below:</p>
<pre>$category_ids = array(4, 5, 6);
wp_set_object_terms( $post_id, $category_ids, 'category');</pre>
<p>The <em>wp_set_object_terms()</em> function take 3 parameters: The post ID, an array of categories ID, and the taxonomy type (In this example, category).</p>
<h2>Adding tags to a post</h2>
<p>Adding tags to a post is extremely simple as well. Even better, it does not require a new function, you can do so by using <em>wp_set_object_terms()</em>.<br /> Take a look at the example below:</p>
<pre>$tag_ids = array(7, 8, 9);
wp_set_object_terms( $post_id, $tag_ids, 'post_tag');</pre>
<p>Looks very similar with the previous piece of code, which allowed us to add categories to a post, isn&#8217;t it? In fact, the only difference is the taxonomy type: Here the parameter is <em>post_tag</em> instead of <em>category</em>.<br /> <strong>Source: <a href="http://wpprogrammer.com/snippets/add-a-category-or-tag-to-a-post-programatically/">http://wpprogrammer.com/snippets/add-a-category-or-tag-to-a-post-programatically/</a></strong></p>
<h2>Automatically create a custom field when a post is published</h2>
<p>I recently had <a href="http://www.webdevcat.com">a client</a> who wanted to have a custom field created automatically, each time he published a new post, so he wouldn&#8217;t have to create a custom field with a default value for each article he wrote.<br /> This piece of code was a real life-saver: Just paste it on your <em>functions.php</em> file and publish a new post: A custom field has been created automatically.</p>
<pre>function add_custom_field_automatically($post_ID) {
	global $wpdb;
	if(!wp_is_post_revision($post_ID)) {
		add_post_meta($post_ID, 'field-name', 'custom value', true);
	}
}
add_action('publish_page', 'add_custom_field_automatically');
add_action('publish_post', 'add_custom_field_automatically');</pre>
<p>So how does it work? First, a function has been created. This function make sure the post isn&#8217;t a revision on then adds a custom field named <em>field-name</em>, with <em>custom value</em> as a value.<br /> Then, a &#8220;hook&#8221; is used to make sure that every time a post or page will be published, the <em>add_custom_field_automatically()</em> function will be called.<br /> <strong>Source: <a href="http://wpcanyon.com/tipsandtricks/adding-a-custom-field-automatically-on-postpage-publish/">http://wpcanyon.com/tipsandtricks/adding-a-custom-field-automatically-on-postpage-publish/</a></strong></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/wordpress-how-to-insert-data-programmatically">WordPress: How to insert data programmatically</a></p>
<div>
<ul>
<li> <a href="http://delicious.com/post?url=http://www.catswhocode.com/blog/wordpress-how-to-insert-data-programmatically&amp;title=WordPress%3A+How+to+insert+data+programmatically" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/wordpress-how-to-insert-data-programmatically&amp;title=WordPress%3A+How+to+insert+data+programmatically&amp;body=Recently%2C%20a%20client%20of%20mine%20asked%20me%20to%20write%20an%20article%20importer%20for%20his%20WordPress%20powered%20site%2C%20which%20was%20a%20very%20interesting%20project%20for%20me.%20In%20this%20article%2C%20I%27ll%20show%20you%20how%20you%20can%20easily%20add%20data%20%28posts%2C%20comments%2C%20categories%2C%20etc%29%20to%20your%20WordPress%20blog%2C%20without%20any%20manual%20effort." rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/wordpress-how-to-insert-data-programmatically&amp;title=WordPress%3A+How+to+insert+data+programmatically" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/wordpress-how-to-insert-data-programmatically&amp;title=WordPress%3A+How+to+insert+data+programmatically" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.catswhocode.com/blog/wordpress-how-to-insert-data-programmatically&amp;t=WordPress%3A+How+to+insert+data+programmatically" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/wordpress-how-to-insert-data-programmatically&amp;title=WordPress%3A+How+to+insert+data+programmatically&amp;body=Recently%2C%20a%20client%20of%20mine%20asked%20me%20to%20write%20an%20article%20importer%20for%20his%20WordPress%20powered%20site%2C%20which%20was%20a%20very%20interesting%20project%20for%20me.%20In%20this%20article%2C%20I%27ll%20show%20you%20how%20you%20can%20easily%20add%20data%20%28posts%2C%20comments%2C%20categories%2C%20etc%29%20to%20your%20WordPress%20blog%2C%20without%20any%20manual%20effort." rel="nofollow" title="Blend this!">Blend this!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/27358__TXeAHyqQZI" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/wordpress-how-to-insert-data-programmatically/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>10 life-saving PHP snippets</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-life-saving-php-snippets/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-life-saving-php-snippets/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 11:30:47 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[consonants]]></category>
		<category><![CDATA[FeedBurner]]></category>
		<category><![CDATA[foreach]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[password function]]></category>
		<category><![CDATA[php snippets]]></category>
		<category><![CDATA[style background]]></category>
		<category><![CDATA[subscriber count]]></category>
		<category><![CDATA[vowels]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-life-saving-php-snippets/</guid>
		<description><![CDATA[Highlight specific words in a phrase Sometimes, for example, when displaying search results, it is a great idea to highlight specific words. This is exactly what the following function can do: function highlight($sString, $aWords) { if (!is_array ($aWords) &#124;&#124; empty ($aWords) &#124;&#124; !is_string ($sString)) { return false; } $sWords = implode ('&#124;', $aWords); return preg_replace [...]]]></description>
			<content:encoded><![CDATA[<h2>Highlight specific words in a phrase</h2>
<p>Sometimes, for example, when displaying search results, it is a great idea to highlight specific words. This is exactly what the following function can do:</p>
<pre>function highlight($sString, $aWords) {
	if (!is_array ($aWords) || empty ($aWords) || !is_string ($sString)) {
		return false;
	}

	$sWords = implode ('|', $aWords);
 	return preg_replace ('@\b('.$sWords.')\b@si', '&lt;strong style="background-color:yellow"&gt;$1&lt;/strong&gt;', $sString);
}</pre>
<p><strong>Source: <a href="http://www.phpsnippets.info/highlights-words-in-a-phrase">http://www.phpsnippets.info/highlights-words-in-a-phrase</a></strong></p>
<h2>Get your average Feedburner subscribers</h2>
<p>Recently, Feedburner counts had lots of problems and it&#8217;s hard to say that the provided info is still relevant. This code will grab your subscriber count from the last 7 days and will return the average.</p>
<pre>function get_average_readers($feed_id,$interval = 7){
	$today = date('Y-m-d', strtotime("now"));
	$ago = date('Y-m-d', strtotime("-".$interval." days"));
	$feed_url="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=".$feed_id."&amp;dates=".$ago.",".$today;
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_URL, $feed_url);
	$data = curl_exec($ch);
	curl_close($ch);
	$xml = new SimpleXMLElement($data);
	$fb = $xml-&gt;feed-&gt;entry['circulation'];

	$nb = 0;
	foreach($xml-&gt;feed-&gt;children() as $circ){
		$nb += $circ['circulation'];
	}

	return round($nb/$interval);
}</pre>
<p><strong>Source: <a href="http://www.catswhoblog.com/how-to-get-a-more-relevant-feedburner-count">http://www.catswhoblog.com/how-to-get-a-more-relevant-feedburner-count</a></strong></p>
<h2>Automatic password creation</h2>
<p>Although I personally prefer leaving users to choose their password themselves, a client recently asked me to generate passwords automatically when a new account is created.<br /> The following function is flexible: You can choose the desired length and strength for the password.</p>
<pre>function generatePassword($length=9, $strength=0) {
	$vowels = 'aeuy';
	$consonants = 'bdghjmnpqrstvz';
	if ($strength &gt;= 1) {
		$consonants .= 'BDGHJLMNPQRSTVWXZ';
	}
	if ($strength &gt;= 2) {
		$vowels .= "AEUY";
	}
	if ($strength &gt;= 4) {
		$consonants .= '23456789';
	}
	if ($strength &gt;= 8 ) {
		$vowels .= '@#$%';
	}

	$password = '';
	$alt = time() % 2;
	for ($i = 0; $i &lt; $length; $i++) {
		if ($alt == 1) {
			$password .= $consonants[(rand() % strlen($consonants))];
			$alt = 0;
		} else {
			$password .= $vowels[(rand() % strlen($vowels))];
			$alt = 1;
		}
	}
	return $password;
}</pre>
<p><strong>Source: </strong><strong><a href="http://www.phpsnippets.info/generate-a-password-in-php">http://www.phpsnippets.info/generate-a-password-in-php</a></strong></p>
<h2>Compress multiple CSS files</h2>
<p>If you&#8217;re using different CSS files on your site, they might take quite long to load. Using PHP, you can compress them into a single file with no unnecessary white spaces or comments.<br /> This snippet has been previously discussed on my &#8220;<a href="http://www.catswhocode.com/blog/3-ways-to-compress-css-files-using-php">3 ways to compress CSS files using PHP</a>&#8221; article.</p>
<pre>header('Content-type: text/css');
ob_start("compress");
function compress($buffer) {
  /* remove comments */
  $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
  /* remove tabs, spaces, newlines, etc. */
  $buffer = str_replace(array("\r\n", "\r", "\n", "\t", '  ', '    ', '    '), '', $buffer);
  return $buffer;
}

/* your css files */
include('master.css');
include('typography.css');
include('grid.css');
include('print.css');
include('handheld.css');

ob_end_flush();</pre>
<p><strong>Source: <a href="http://www.phpsnippets.info/compress-css-files-using-php">http://www.phpsnippets.info/compress-css-files-using-php</a></strong></p>
<h2>Get short urls for Twitter</h2>
<p>Are you on <a href="http://www.twitter.com/catswhocode">Twitter</a>? If yes, you probably use a url shortener such as bit.ly or TinyUrl to share your favorite blog posts and links on the network.<br /> This snippet take a url as a parameter and will return a short url.</p>
<pre>function getTinyUrl($url) {
    return file_get_contents("http://tinyurl.com/api-create.php?url=".$url);
}</pre>
<p><strong>Source: <a href="http://www.phpsnippets.info/convert-url-to-tinyurl">http://www.phpsnippets.info/convert-url-to-tinyurl</a></strong></p>
<h2>Calculate age using date of birth</h2>
<p>Pass a birth date to this function, and it will return the age of the person; very useful when building communities or social media sites.</p>
<pre>function age($date){
	$year_diff = '';
	$time = strtotime($date);
	if(FALSE === $time){
		return '';
	}

	$date = date('Y-m-d', $time);
	list($year,$month,$day) = explode("-",$date);
	$year_diff = date("Y") – $year;
	$month_diff = date("m") – $month;
	$day_diff = date("d") – $day;
	if ($day_diff &lt; 0 || $month_diff &lt; 0) $year_diff–;

	return $year_diff;
}</pre>
<p><strong>Source: <a href="http://www.phpsnippets.info/calculate-age-of-a-person-using-date-of-birth#comment-25">John Karry on http://www.phpsnippets.info/calculate-age-of-a-person-using-date-of-birth</a></strong></p>
<h2>Calculate execution time</h2>
<p>For debugging purposes, it is a good thing to be able to calculate the execution time of a script. This is exactly what this piece of code can do.</p>
<pre>//Create a variable for start time
$time_start = microtime(true);

// Place your PHP/HTML/JavaScript/CSS/Etc. Here

//Create a variable for end time
$time_end = microtime(true);
//Subtract the two times to get seconds
$time = $time_end - $time_start;

echo 'Script took '.$time.' seconds to execute';</pre>
<p><strong>Source: <a href="http://phpsnips.com/snippet.php?id=26">http://phpsnips.com/snippet.php?id=26</a></strong></p>
<h2>Maintenance mode with PHP</h2>
<p>When updating your site, it is generally a good thing to temporarily redirect your users to a &#8220;Maintenance&#8221; page so they will not see any critical info such as error messages.<br /> This is generally done using an .htaccess file, but it can be done easily with PHP:</p>
<pre>function maintenance($mode = FALSE){
    if($mode){
        if(basename($_SERVER['SCRIPT_FILENAME']) != 'maintenance.php'){
            header("Location: http://example.com/maintenance.php");
            exit;
        }
    }else{
        if(basename($_SERVER['SCRIPT_FILENAME']) == 'maintenance.php'){
            header("Location: http://example.com/");
            exit;
        }
    }
}</pre>
<p><strong>Source: <a href="http://www.phpsnippets.info/easy-maintenance-mode-with-php">http://www.phpsnippets.info/easy-maintenance-mode-with-php</a></strong></p>
<h2>Prevent js and css files from being cached</h2>
<p>By default, external files such as javascript and css are cached by the browser. If you want to prevent this from caching, simply use this easy tip:</p>
<pre>&lt;link href="/stylesheet.css?&lt;?php echo time(); ?&gt;" rel="stylesheet" type="text/css" /&amp;glt;</pre>
<p>The result will look like this:</p>
<pre>&lt;link href="/stylesheet.css?1234567890" rel="stylesheet" type="text/css" /&amp;glt;</pre>
<p><strong>Source: <a href="http://davidwalsh.name/prevent-cache">http://davidwalsh.name/prevent-cache</a></strong></p>
<h2>Add (th, st, nd, rd, th) to the end of a number</h2>
<p>Another useful snippet which will automatically add <em>st</em>, <em>nd</em>, <em>rd</em> or <em>th</em> after a number.</p>
<pre>function make_ranked($rank) {
	$last = substr( $rank, -1 );
	$seclast = substr( $rank, -2, -1 );
	if( $last &gt; 3 || $last == 0 ) $ext = 'th';
	else if( $last == 3 ) $ext = 'rd';
	else if( $last == 2 ) $ext = 'nd';
	else $ext = 'st'; 

	if( $last == 1 &amp;&amp; $seclast == 1) $ext = 'th';
	if( $last == 2 &amp;&amp; $seclast == 1) $ext = 'th';
	if( $last == 3 &amp;&amp; $seclast == 1) $ext = 'th'; 

	return $rank.$ext;
}</pre>
<p><strong>Source: <a href="http://phpsnips.com/snippet.php?id=37">http://phpsnips.com/snippet.php?id=37</a></strong></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/10-life-saving-php-snippets">10 life-saving PHP snippets</a></p>
<div>
<ul>
<li> <a href="http://delicious.com/post?url=http://www.catswhocode.com/blog/10-life-saving-php-snippets&amp;title=10+life-saving+PHP+snippets+" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/10-life-saving-php-snippets&amp;title=10+life-saving+PHP+snippets+&amp;body=In%20order%20to%20be%20efficient%2C%20a%20web%20developer%20should%20have%20a%20toolbox%20with%20code%20snippets%20he%20can%20use%20and%20reuse%20when%20needed.%20In%20this%20article%2C%20I%27m%20going%20to%20show%20you%2010%20extremely%20useful%20PHP%20code%20snippets%20to%20add%20to%20your%20web%20developer%20toolbox." rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/10-life-saving-php-snippets&amp;title=10+life-saving+PHP+snippets+" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/10-life-saving-php-snippets&amp;title=10+life-saving+PHP+snippets+" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.catswhocode.com/blog/10-life-saving-php-snippets&amp;t=10+life-saving+PHP+snippets+" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/10-life-saving-php-snippets&amp;title=10+life-saving+PHP+snippets+&amp;body=In%20order%20to%20be%20efficient%2C%20a%20web%20developer%20should%20have%20a%20toolbox%20with%20code%20snippets%20he%20can%20use%20and%20reuse%20when%20needed.%20In%20this%20article%2C%20I%27m%20going%20to%20show%20you%2010%20extremely%20useful%20PHP%20code%20snippets%20to%20add%20to%20your%20web%20developer%20toolbox." rel="nofollow" title="Blend this!">Blend this!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/95501_CsWDXAnJY0Y" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-life-saving-php-snippets/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to create a built-in contact form for your WordPress theme</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-built-in-contact-form-for-your-wordpress-theme/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-built-in-contact-form-for-your-wordpress-theme/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 23:00:48 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[code lt]]></category>
		<category><![CDATA[div class]]></category>
		<category><![CDATA[div id]]></category>
		<category><![CDATA[input type text]]></category>
		<category><![CDATA[page template]]></category>
		<category><![CDATA[php template]]></category>
		<category><![CDATA[site php]]></category>
		<category><![CDATA[template name]]></category>
		<category><![CDATA[textarea name]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-built-in-contact-form-for-your-wordpress-theme/</guid>
		<description><![CDATA[Getting Ready You can see the working form on my site PHP Snippets. It is a site of mine, so don&#8217;t hesitate to grab the RSS feed and follow it on Twitter if you want. Step 1: Creating the page template The first step is to create a page template. To do so, copy the [...]]]></description>
			<content:encoded><![CDATA[<h2>Getting Ready</h2>
<p>You can see the working form on my site <a href="http://www.phpsnippets.info">PHP Snippets</a>. It is a site of mine, so don&#8217;t hesitate to grab the <a href="http://feeds.feedburner.com/phps">RSS feed</a> and <a href="http://twitter.com/phpsnippets">follow it on Twitter</a> if you want.<br /> <a href="http://www.phpsnippets.info/contact"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/7f1d3_wordpress-built-in-contact-form.jpg" alt="" /></a></p>
<h2>Step 1: Creating the page template</h2>
<p>The first step is to create a page template. To do so, copy the <em>page.php</em> code into a new file named <em>page-contact.php</em>.</p>
<p>We have to add a comment at the beginning of the <em>contact.php</em> file to make sure WordPress will treat the file as a page template. Here&#8217;s the code:</p>
<pre>&lt;?php
/*
Template Name: Contact
*/
?&gt;</pre>
<p>Your contact.php file should look like this:</p>
<pre>&lt;?php
/*
Template Name: Contact
*/
?&gt;

&lt;?php get_header() ?&gt;

	&lt;div id="container"&gt;
		&lt;div id="content"&gt;
			&lt;?php the_post() ?&gt;
			&lt;div id="post-&lt;?php the_ID() ?&gt;" class="post"&gt;
				&lt;div class="entry-content"&gt;
				&lt;/div&gt;&lt;!-- .entry-content -&gt;
			&lt;/div&gt;&lt;!-- .post--&gt;
		&lt;/div&gt;&lt;!-- #content --&gt;
	&lt;/div&gt;&lt;!-- #container --&gt;

&lt;?php get_sidebar() ?&gt;
&lt;?php get_footer() ?&gt;</pre>
<h2>Step 2: Building the form</h2>
<p>Now, we have to create a simple contact form. Simply paste the following code within the <em>entry-content</em> div.</p>
<pre>&lt;form action="&lt;?php the_permalink(); ?&gt;" id="contactForm" method="post"&gt;
	&lt;ul&gt;
		&lt;li&gt;
			&lt;label for="contactName"&gt;Name:&lt;/label&gt;
			&lt;input type="text" name="contactName" id="contactName" value="" /&gt;
		&lt;/li&gt;
		&lt;li&gt;
			&lt;label for="email"&gt;Email&lt;/label&gt;
			&lt;input type="text" name="email" id="email" value="" /&gt;
		&lt;/li&gt;
		&lt;li&gt;
			&lt;label for="commentsText"&gt;Message:&lt;/label&gt;
			&lt;textarea name="comments" id="commentsText" rows="20" cols="30"&gt;&lt;/textarea&gt;
		&lt;/li&gt;
		&lt;li&gt;
			&lt;button type="submit"&gt;Send email&lt;/button&gt;
		&lt;/li&gt;
	&lt;/ul&gt;
	&lt;input type="hidden" name="submitted" id="submitted" value="true" /&gt;
&lt;/form&gt;</pre>
<p>Nothing hard with this pretty self-explanatory html code for our form. Note the <em>input type=&#8221;hidden&#8221;</em> I added on line 19: It will be used later to check if the form has been submitted.</p>
<h2>Step 3: data processing and error handling</h2>
<p>Our form looks pretty good, but right it is very useless because it does not send any email. What we have to do is to verify if the form has been submitted then verify if fields have been filled correctly.</p>
<p>If fields are correctly filled, we&#8217;ll get the blog admin email and send them the email. Otherwise, no email will be sent and errors will be displayed to the user.</p>
<p>Paste the following code between the Page Template declaration and the get_header() function:</p>
<pre>&lt;?php
if(isset($_POST['submitted'])) {
	if(trim($_POST['contactName']) === '') {
		$nameError = 'Please enter your name.';
		$hasError = true;
	} else {
		$name = trim($_POST['contactName']);
	}

	if(trim($_POST['email']) === '')  {
		$emailError = 'Please enter your email address.';
		$hasError = true;
	} else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
		$emailError = 'You entered an invalid email address.';
		$hasError = true;
	} else {
		$email = trim($_POST['email']);
	}

	if(trim($_POST['comments']) === '') {
		$commentError = 'Please enter a message.';
		$hasError = true;
	} else {
		if(function_exists('stripslashes')) {
			$comments = stripslashes(trim($_POST['comments']));
		} else {
			$comments = trim($_POST['comments']);
		}
	}

	if(!isset($hasError)) {
		$emailTo = get_option('tz_email');
		if (!isset($emailTo) || ($emailTo == '') ){
			$emailTo = get_option('admin_email');
		}
		$subject = '[PHP Snippets] From '.$name;
		$body = "Name: $name \n\nEmail: $email \n\nComments: $comments";
		$headers = 'From: '.$name.' &lt;'.$emailTo.'&gt;' . "\r\n" . 'Reply-To: ' . $email;

		mail($emailTo, $subject, $body, $headers);
		$emailSent = true;
	}

} ?&gt;</pre>
<p>What I&#8217;ve done here was simply to make sure that the form has been submitted and filled correctly. If an error, such as an empty field or incorrect email address occurred, a message is returned and the form isn&#8217;t submitted.</p>
<p>Now we have to display error messages below the related field, for example &#8220;Please enter your name&#8221;. <strong>Below you&#8217;ll find the complete form page template that you can use &#8220;as it&#8221;.</strong></p>
<pre>&lt;?php
/*
Template Name: Contact
*/
?&gt;

&lt;?php
if(isset($_POST['submitted'])) {
	if(trim($_POST['contactName']) === '') {
		$nameError = 'Please enter your name.';
		$hasError = true;
	} else {
		$name = trim($_POST['contactName']);
	}

	if(trim($_POST['email']) === '')  {
		$emailError = 'Please enter your email address.';
		$hasError = true;
	} else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
		$emailError = 'You entered an invalid email address.';
		$hasError = true;
	} else {
		$email = trim($_POST['email']);
	}

	if(trim($_POST['comments']) === '') {
		$commentError = 'Please enter a message.';
		$hasError = true;
	} else {
		if(function_exists('stripslashes')) {
			$comments = stripslashes(trim($_POST['comments']));
		} else {
			$comments = trim($_POST['comments']);
		}
	}

	if(!isset($hasError)) {
		$emailTo = get_option('tz_email');
		if (!isset($emailTo) || ($emailTo == '') ){
			$emailTo = get_option('admin_email');
		}
		$subject = '[PHP Snippets] From '.$name;
		$body = "Name: $name \n\nEmail: $email \n\nComments: $comments";
		$headers = 'From: '.$name.' &lt;'.$emailTo.'&gt;' . "\r\n" . 'Reply-To: ' . $email;

		mail($emailTo, $subject, $body, $headers);
		$emailSent = true;
	}

} ?&gt;
&lt;?php get_header(); ?&gt;
	&lt;div id="container"&gt;
		&lt;div id="content"&gt;

			&lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;
			&lt;div &lt;?php post_class() ?&gt; id="post-&lt;?php the_ID(); ?&gt;"&gt;
				&lt;h1 class="entry-title"&gt;&lt;?php the_title(); ?&gt;&lt;/h1&gt;
					&lt;div class="entry-content"&gt;
						&lt;?php if(isset($emailSent) &amp;&amp; $emailSent == true) { ?&gt;
							&lt;div class="thanks"&gt;
								&lt;p&gt;Thanks, your email was sent successfully.&lt;/p&gt;
							&lt;/div&gt;
						&lt;?php } else { ?&gt;
							&lt;?php the_content(); ?&gt;
							&lt;?php if(isset($hasError) || isset($captchaError)) { ?&gt;
								&lt;p class="error"&gt;Sorry, an error occured.&lt;p&gt;
							&lt;?php } ?&gt;

						&lt;form action="&lt;?php the_permalink(); ?&gt;" id="contactForm" method="post"&gt;
							&lt;ul class="contactform"&gt;
							&lt;li&gt;
								&lt;label for="contactName"&gt;Name:&lt;/label&gt;
								&lt;input type="text" name="contactName" id="contactName" value="&lt;?php if(isset($_POST['contactName'])) echo $_POST['contactName'];?&gt;" class="required requiredField" /&gt;
								&lt;?php if($nameError != '') { ?&gt;
									&lt;span class="error"&gt;&lt;?=$nameError;?&gt;&lt;/span&gt;
								&lt;?php } ?&gt;
							&lt;/li&gt;

							&lt;li&gt;
								&lt;label for="email"&gt;Email&lt;/label&gt;
								&lt;input type="text" name="email" id="email" value="&lt;?php if(isset($_POST['email']))  echo $_POST['email'];?&gt;" class="required requiredField email" /&gt;
								&lt;?php if($emailError != '') { ?&gt;
									&lt;span class="error"&gt;&lt;?=$emailError;?&gt;&lt;/span&gt;
								&lt;?php } ?&gt;
							&lt;/li&gt;

							&lt;li&gt;&lt;label for="commentsText"&gt;Message:&lt;/label&gt;
								&lt;textarea name="comments" id="commentsText" rows="20" cols="30" class="required requiredField"&gt;&lt;?php if(isset($_POST['comments'])) { if(function_exists('stripslashes')) { echo stripslashes($_POST['comments']); } else { echo $_POST['comments']; } } ?&gt;&lt;/textarea&gt;
								&lt;?php if($commentError != '') { ?&gt;
									&lt;span class="error"&gt;&lt;?=$commentError;?&gt;&lt;/span&gt;
								&lt;?php } ?&gt;
							&lt;/li&gt;

							&lt;li&gt;
								&lt;input type="submit"&gt;Send email&lt;/input&gt;
							&lt;/li&gt;
						&lt;/ul&gt;
						&lt;input type="hidden" name="submitted" id="submitted" value="true" /&gt;
					&lt;/form&gt;
				&lt;?php } ?&gt;
				&lt;/div&gt;&lt;!-- .entry-content --&gt;
			&lt;/div&gt;&lt;!-- .post --&gt;

				&lt;?php endwhile; endif; ?&gt;
		&lt;/div&gt;&lt;!-- #content --&gt;
	&lt;/div&gt;&lt;!-- #container --&gt;

&lt;?php get_sidebar(); ?&gt;
&lt;?php get_footer(); ?&gt;</pre>
<h2>Step 4: Adding jQuery verification</h2>
<p>Our form is now working perfectly. But we can enhance it by adding a client side verification. To do so, I&#8217;m going to use jQuery and the <a href="http://docs.jquery.com/Plugins/Validation">validate jQuery plugin</a>. This plugin is great because it allows you to verify that a form has been filled correctly, quickly and easily.</p>
<p>The first thing to do is to <a href="http://docs.jquery.com/Plugins/Validation">download the validate plugin</a> and upload it into your theme file (under a <em>/js</em> directory). Once done, paste the following into a new file:</p>
<pre>$(document).ready(function(){
	$("#contactForm").validate();
});</pre>
<p>Save it as <em>verif.js</em> in your /js directory.</p>
<p>Now we have to link the javascript files to our theme. Open your <em>header.php</em> file and paste the following within the &lt;head&gt; and &lt;/head&gt; tags:</p>
<pre>&lt;?php if( is_page('contact') ){ ?&gt;
	&lt;script type="text/javascript" src="&lt;?php bloginfo('template_directory'); ?&gt;/js/jquery.validate.min.js"&gt;&lt;/script&gt;
	&lt;script type="text/javascript" src="&lt;?php bloginfo('template_directory'); ?&gt;/js/verif.js"&gt;&lt;/script&gt;
&lt;?php }?&gt;</pre>
<p>Once done, your form will be validated on the client side by the jQuery validate plugin. How does it work? It simply picks form element which have the css class <em>required</em> and verifies if they&#8217;re filled correctly. If not, a message is displayed.<br /> The plugin is powerful and you can do lots of things with it, however this isn&#8217;t the purpose of this article. Hope you enjoy your new WordPress form!</p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/how-to-create-a-built-in-contact-form-for-your-wordpress-theme">How to create a built-in contact form for your WordPress theme</a></p>
<div>
<ul>
<li> <a href="http://delicious.com/post?url=http://www.catswhocode.com/blog/how-to-create-a-built-in-contact-form-for-your-wordpress-theme&amp;title=How+to+create+a+built-in+contact+form+for+your+WordPress+theme" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/how-to-create-a-built-in-contact-form-for-your-wordpress-theme&amp;title=How+to+create+a+built-in+contact+form+for+your+WordPress+theme&amp;body=Many%20WordPress%20plugins%20can%20add%20a%20contact%20form%20to%20your%20blog%2C%20but%20a%20plugin%20is%20not%20necessary.%20In%20this%20tutorial%2C%20I%27m%20going%20to%20show%20you%20how%20you%20can%20create%20a%20built-in%20contact%20form%20for%20your%20WordPress%20theme." rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/how-to-create-a-built-in-contact-form-for-your-wordpress-theme&amp;title=How+to+create+a+built-in+contact+form+for+your+WordPress+theme" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/how-to-create-a-built-in-contact-form-for-your-wordpress-theme&amp;title=How+to+create+a+built-in+contact+form+for+your+WordPress+theme" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.catswhocode.com/blog/how-to-create-a-built-in-contact-form-for-your-wordpress-theme&amp;t=How+to+create+a+built-in+contact+form+for+your+WordPress+theme" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/how-to-create-a-built-in-contact-form-for-your-wordpress-theme&amp;title=How+to+create+a+built-in+contact+form+for+your+WordPress+theme&amp;body=Many%20WordPress%20plugins%20can%20add%20a%20contact%20form%20to%20your%20blog%2C%20but%20a%20plugin%20is%20not%20necessary.%20In%20this%20tutorial%2C%20I%27m%20going%20to%20show%20you%20how%20you%20can%20create%20a%20built-in%20contact%20form%20for%20your%20WordPress%20theme." rel="nofollow" title="Blend this!">Blend this!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/7f1d3_eGagKTSLvfs" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-built-in-contact-form-for-your-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to create a side blog with WordPress 3.0</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-side-blog-with-wordpress-3-0/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-side-blog-with-wordpress-3-0/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 21:56:43 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[amp]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[codex]]></category>
		<category><![CDATA[coupons]]></category>
		<category><![CDATA[dashboard]]></category>
		<category><![CDATA[excerpt]]></category>
		<category><![CDATA[page template]]></category>
		<category><![CDATA[parameters]]></category>
		<category><![CDATA[slug]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-side-blog-with-wordpress-3-0/</guid>
		<description><![CDATA[Getting ready So, what are custom post types? That&#8217;s simple, custom post types are like a blog post or page, but of a custom defined type. As an example, I decided to list some promo codes on my other blog CatsWhoBlog. I could have used a good old static page, but updating it and adding [...]]]></description>
			<content:encoded><![CDATA[<h2>Getting ready</h2>
<p>So, what are custom post types? That&#8217;s simple, custom post types are like a blog post or page, but of a custom defined type.<br /> As an example, I decided to list some <a href="http://www.catswhoblog.com/coupons">promo codes</a> on my other blog CatsWhoBlog. I could have used a good old static page, but updating it and adding new promo codes would have been a pain.</p>
<p>So I created a custom post type, named <em>coupon</em> and a page template to list all <em>coupons</em>. It&#8217;s as simple as that, and now managing coupons &amp; promo codes is extremely easy:</p>
<p><a href="http://www.catswhoblog.com/coupons"><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/3b111_wp2.jpg" alt="" /></a></p>
<h2>Creating the post type</h2>
<p>Ok, let&#8217;s code. The first thing to do is to create a custom post type. To do so, pick up your theme functions.php file, and add the following:</p>
<pre>function create_my_post_types() {
    register_post_type('coupons',
        array(
            'label' =&gt; __('Coupons'),
            'singular_label' =&gt; __('Coupon'),
            'public' =&gt; true,
            'supports' =&gt; array(
                'title',
                'excerpt',
                'comments',
                'custom-fields'
	    ),
	    'rewrite' =&gt; array(
	        'slug' =&gt; 'coupons',
	        'with_front' =&gt; false
	    ),
        )
    );
}
add_action( 'init', 'create_my_post_types' );</pre>
<p>Once you saved functions.php, you should notice that a new tab appeared in your WordPress dashboard, as shown in the picture below:<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/11783_wordpress-30-custom.jpg" alt="" /></p>
<p>So what does this code do?<br /> First, I have created a function which registers a new post type, named <em>coupons</em>. I gave the following parameters to the register_post_type() function:</p>
<ul>
<li><strong>label</strong>: Nicename of your post type.</li>
<li><strong>singular_label</strong>: Pretty self explanatory, the singular label of your post type.</li>
<li><strong>public</strong>: Allows post type to be seen publicly.</li>
<li><strong>supports</strong>: Array of data of what the post type supports (editor, excerpt, comments, custom fields, etc&#8230;)</li>
<li><strong>rewrite</strong>: Parameters for url rewriting and general post type display.</li>
</ul>
<p>The complete parameter list can be found on <a rel="nofollow" href="http://codex.wordpress.org/Function_Reference/register_post_type">WordPress Codex</a>.</p>
<p>Then, I &#8220;hooked&#8221; this function to WordPress <em>init()</em> function using <em>add_action()</em>.</p>
<h2>Adding data</h2>
<p>Now that the post type has been created, you can add data by clicking on the &#8220;Add Coupon&#8221; (Or whatever you named it) link in WordPress dashboard menu.</p>
<p>You should see the following:<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/fc832_wordpress-custom-post-types.jpg" alt="" /></p>
<h2>Creating a page template to list custom post types</h2>
<p>Now that we have created a custom post type and added some custom posts, we still have to display it. To do so, I have used a page template. You can easily reuse the following code, or adapt it to display in your blog sidebar, for example.<br /> If you want to see a demo of the page template, just <a href="http://www.catswhoblog.com/coupons">click here</a>.</p>
<pre>&lt;?php
/*
Template Name: Promo codes Page
*/
?&gt;
&lt;?php get_header() ?&gt;

	&lt;div id="container"&gt;
		&lt;div id="content" class="coupons"&gt;
			&lt;h1 class="entry-title"&gt;&lt;?php the_title(); ?&gt;&lt;/h1&gt;
			&lt;?php the_content(); ?&gt;

			&lt;?php global $wp_query;
			$page_num = $paged;
			if($pagenum='') $pagenum=1;

			$wp_query = new WP_Query("showposts=20&amp;post_type=coupons&amp;post_status=publish&amp;paged=".$page_num);

			while ($wp_query-&gt;have_posts()) : $wp_query-&gt;the_post(); ?&gt;

				&lt;div class="post" id="post-&lt;?php the_ID(); ?&gt;"&gt;
					&lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;
					&lt;div class="exerpt"&gt;&lt;?php the_excerpt(); ?&gt;&lt;/div&gt;
				&lt;/div&gt;&lt;!-- .post --&gt;

			&lt;?php endwhile; ?&gt;

			&lt;div class="navigation"&gt;&lt;p&gt;&lt;?php posts_nav_link(); ?&gt;&lt;/p&gt;&lt;/div&gt;

		&lt;/div&gt;&lt;!-- #content --&gt;
	&lt;/div&gt;&lt;!-- #container --&gt;

&lt;?php get_sidebar() ?&gt;
&lt;?php get_footer() ?&gt;</pre>
<p>As you can see, the code I&#8217;ve used is definitely easy and self-explanatory. In order to fetch a specific post type, you have to specify the parameter <em>post_type=coupons</em>.</p>
<p>That&#8217;s all for today, hope you enjoyed this tutorial!</p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/how-to-create-a-side-blog-with-wordpress-3-0">How to create a side blog with WordPress 3.0</a></p>
<div>
<ul>
<li> <a href="http://delicious.com/post?url=http://www.catswhocode.com/blog/how-to-create-a-side-blog-with-wordpress-3-0&amp;title=How+to+create+a+side+blog+with+WordPress+3.0" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/how-to-create-a-side-blog-with-wordpress-3-0&amp;title=How+to+create+a+side+blog+with+WordPress+3.0&amp;body=Finally%21%20WordPress%203.0%20was%20released%20last%20week.%20Among%20other%20exiting%20features%2C%20custom%20post%20types%20are%20bringing%20lots%20of%20new%20possibilities%20to%20bloggers.%20In%20this%20tutorial%2C%20I%27ll%20show%20you%20how%20to%20create%20a%20side%20blog%20listing%20products%20using%20the%20WordPress%203.0%20custom%20post%20type%20feature." rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/how-to-create-a-side-blog-with-wordpress-3-0&amp;title=How+to+create+a+side+blog+with+WordPress+3.0" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/how-to-create-a-side-blog-with-wordpress-3-0&amp;title=How+to+create+a+side+blog+with+WordPress+3.0" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.catswhocode.com/blog/how-to-create-a-side-blog-with-wordpress-3-0&amp;t=How+to+create+a+side+blog+with+WordPress+3.0" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/how-to-create-a-side-blog-with-wordpress-3-0&amp;title=How+to+create+a+side+blog+with+WordPress+3.0&amp;body=Finally%21%20WordPress%203.0%20was%20released%20last%20week.%20Among%20other%20exiting%20features%2C%20custom%20post%20types%20are%20bringing%20lots%20of%20new%20possibilities%20to%20bloggers.%20In%20this%20tutorial%2C%20I%27ll%20show%20you%20how%20to%20create%20a%20side%20blog%20listing%20products%20using%20the%20WordPress%203.0%20custom%20post%20type%20feature." rel="nofollow" title="Blend this!">Blend this!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/fc832_EU1XZgIQU2Y" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-create-a-side-blog-with-wordpress-3-0/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>10 PHP code snippets for working with strings</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-php-code-snippets-for-working-with-strings/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-php-code-snippets-for-working-with-strings/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 00:15:14 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[code snippets]]></category>
		<category><![CDATA[html tags]]></category>
		<category><![CDATA[input source]]></category>
		<category><![CDATA[isset]]></category>
		<category><![CDATA[php code]]></category>
		<category><![CDATA[return source]]></category>
		<category><![CDATA[strlen]]></category>
		<category><![CDATA[text strip]]></category>
		<category><![CDATA[word message]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-php-code-snippets-for-working-with-strings/</guid>
		<description><![CDATA[Automatically remove html tags from a string On user-submitted forms, you may want to remove all unnecessary html tags. Doing so is easy using the strip_tags() function: $text = strip_tags($input, ""); Source: http://phpbuilder.com/columns/Jason_Gilmore060210.php3?page=2 Get the text between $start and $end This is the kind of function every web developer should have in their toolbox for [...]]]></description>
			<content:encoded><![CDATA[<h2>Automatically remove html tags from a string</h2>
<p>On user-submitted forms, you may want to remove all unnecessary html tags. Doing so is easy using the strip_tags() function:</p>
<pre>$text = strip_tags($input, "");</pre>
<p><strong>Source: <a href="http://phpbuilder.com/columns/Jason_Gilmore060210.php3?page=2">http://phpbuilder.com/columns/Jason_Gilmore060210.php3?page=2</a></strong></p>
<h2>Get the text between $start and $end</h2>
<p>This is the kind of function every web developer should have in their toolbox for future use: give it a string, a start, and an end, and it will return the text contained with $start and $end.</p>
<pre>function GetBetween($content,$start,$end){
    $r = explode($start, $content);
    if (isset($r[1])){
        $r = explode($end, $r[1]);
        return $r[0];
    }
    return '';
}</pre>
<p><strong>Source: <a href="http://www.jonasjohn.de/snippets/php/get-between.htm">http://www.jonasjohn.de/snippets/php/get-between.htm</a></strong></p>
<h2>Transform URL to hyperlinks</h2>
<p>If you leave a URL in the comment form of a WordPress blog, it will be automatically transformed into a hyperlink. If you want to implement the same functionality in your own website or web app, you can use the following code:</p>
<pre>
$url = "Jean-Baptiste Jung (http://www.webdevcat.com)";
$url = preg_replace("#http://([A-z0-9./-]+)#", '<a href="http://www.catswhocode.com/$1">$0</a>', $url);
</pre>
<p><strong>Source: <a href="http://phpbuilder.com/columns/Jason_Gilmore060210.php3?page=2">http://phpbuilder.com/columns/Jason_Gilmore060210.php3?page=2</a></strong></p>
<h2>Split text up into 140 char array for Twitter</h2>
<p>As you probably know, <a href="http://www.twitter.com/catswhocode">Twitter</a> only accepts messages of 140 characters or less. If you want to interact with the popular social messaging site, you&#8217;ll enjoy this function for sure, which will allow you to truncate your message to 140 characters.</p>
<pre>function split_to_chunks($to,$text){
	$total_length = (140 - strlen($to));
	$text_arr = explode(" ",$text);
	$i=0;
	$message[0]="";
	foreach ($text_arr as $word){
		if ( strlen($message[$i] . $word . ' ') &lt;= $total_length ){
			if ($text_arr[count($text_arr)-1] == $word){
				$message[$i] .= $word;
			} else {
				$message[$i] .= $word . ' ';
			}
		} else {
			$i++;
			if ($text_arr[count($text_arr)-1] == $word){
				$message[$i] = $word;
			} else {
				$message[$i] = $word . ' ';
			}
		}
	}
	return $message;
}</pre>
<p><strong>Source: <a href="http://snipplr.com/view.php?codeview&amp;id=31648">http://snipplr.com/view.php?codeview&amp;id=31648</a></strong></p>
<h2>Remove URLs from string</h2>
<p>When I see the amount of URLs people try to leave in my blog comments to get traffic and/or backlinks, I think I should definitely give a go to this snippet!</p>
<pre>$string = preg_replace('/\b(https?|ftp|file):\/\/[-A-Z0-9+&amp;@#\/%?=~_|$!:,.;]*[A-Z0-9+&amp;@#\/%=~_|$]/i', '', $string);</pre>
<p><strong>Source: <a href="http://snipplr.com/view.php?codeview&amp;id=15236">http://snipplr.com/view.php?codeview&amp;id=15236</a></strong></p>
<h2>Convert strings to slugs</h2>
<p>Need to generate slugs (permalinks) that are SEO friendly? The following function takes a string as a parameter and will return a SEO friendly slug. Simple and efficient!</p>
<pre>function slug($str){
	$str = strtolower(trim($str));
	$str = preg_replace('/[^a-z0-9-]/', '-', $str);
	$str = preg_replace('/-+/', "-", $str);
	return $str;
}</pre>
<p><strong>Source: <a href="http://snipplr.com/view.php?codeview&amp;id=2809">http://snipplr.com/view.php?codeview&amp;id=2809</a></strong></p>
<h2>Parse CSV files</h2>
<p>CSV (Coma separated values) files are an easy way to store data, and parsing them using PHP is dead simple. Don&#8217;t believe me? Just use the following snippet and see for yourself.</p>
<pre>$fh = fopen("contacts.csv", "r");
while($line = fgetcsv($fh, 1000, ",")) {
    echo "Contact: {$line[1]}";
}</pre>
<p><strong>Source: <a href="http://phpbuilder.com/columns/Jason_Gilmore060210.php3?page=1">http://phpbuilder.com/columns/Jason_Gilmore060210.php3?page=1</a></strong></p>
<h2>Search for a string in another string</h2>
<p>If a string is contained in another string and you need to search for it, this is a very clever way to do it:</p>
<pre>function contains($str, $content, $ignorecase=true){
    if ($ignorecase){
        $str = strtolower($str);
        $content = strtolower($content);
    }
    return strpos($content,$str) ? true : false;
}</pre>
<p><strong>Source: <a href="http://www.jonasjohn.de/snippets/php/contains.htm">http://www.jonasjohn.de/snippets/php/contains.htm</a></strong></p>
<h2>Check if a string starts with a specific pattern</h2>
<p>Some languages such as Java have a startWith method/function which allows you to check if a string starts with a specific pattern. Unfortunately, PHP does not have a similar built-in function.<br /> Whatever- we just have to build our own, which is very simple:</p>
<pre>function String_Begins_With($needle, $haystack {
    return (substr($haystack, 0, strlen($needle))==$needle);
}</pre>
<p><strong>Source: <a href="http://snipplr.com/view.php?codeview&amp;id=2143">http://snipplr.com/view.php?codeview&amp;id=2143</a></strong></p>
<h2>Extract emails from a string</h2>
<p>Ever wondered how spammers can get your email address? That&#8217;s simple, they get web pages (such as forums) and simply parse the html to extract emails. This code takes a string as a parameter, and will print all emails contained within. Please don&#8217;t use this code for spam <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/c7dad_icon_wink.gif" alt=";)" class="wp-smiley" /></p>
<pre>function extract_emails($str){
    // This regular expression extracts all emails from a string:
    $regexp = '/([a-z0-9_\.\-])+\@(([a-z0-9\-])+\.)+([a-z0-9]{2,4})+/i';
    preg_match_all($regexp, $str, $m);

    return isset($m[0]) ? $m[0] : array();
}

$test_string = 'This is a test string...

        test1@example.org

        Test different formats:
        test2@example.org;
        &lt;a href="test3@example.org"&gt;foobar&lt;/a&gt;
        &lt;test4@example.org&gt;

        strange formats:
        test5@example.org
        test6[at]example.org
        test7@example.net.org.com
        test8@ example.org
        test9@!foo!.org

        foobar
';

print_r(extract_emails($test_string));</pre>
<p><strong>Source: <a href="http://www.jonasjohn.de/snippets/php/extract-emails.htm">http://www.jonasjohn.de/snippets/php/extract-emails.htm</a></strong></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/10-php-code-snippets-for-working-with-strings">10 PHP code snippets for working with strings</a></p>
<div>
<ul>
<li> <a href="http://delicious.com/post?url=http://www.catswhocode.com/blog/10-php-code-snippets-for-working-with-strings&amp;title=10+PHP+code+snippets+for+working+with+strings" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/10-php-code-snippets-for-working-with-strings&amp;title=10+PHP+code+snippets+for+working+with+strings&amp;body=Strings%20are%20a%20very%20important%20kind%20of%20data%2C%20and%20you%20have%20to%20deal%20with%20them%20daily%20with%20web%20development%20tasks.%20In%20this%20article%2C%20I%20have%20compiled%2010%20extremely%20useful%20functions%20and%20code%20snippets%20to%20make%20your%20php%20developer%20life%20easier." rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/10-php-code-snippets-for-working-with-strings&amp;title=10+PHP+code+snippets+for+working+with+strings" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/10-php-code-snippets-for-working-with-strings&amp;title=10+PHP+code+snippets+for+working+with+strings" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.catswhocode.com/blog/10-php-code-snippets-for-working-with-strings&amp;t=10+PHP+code+snippets+for+working+with+strings" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/10-php-code-snippets-for-working-with-strings&amp;title=10+PHP+code+snippets+for+working+with+strings&amp;body=Strings%20are%20a%20very%20important%20kind%20of%20data%2C%20and%20you%20have%20to%20deal%20with%20them%20daily%20with%20web%20development%20tasks.%20In%20this%20article%2C%20I%20have%20compiled%2010%20extremely%20useful%20functions%20and%20code%20snippets%20to%20make%20your%20php%20developer%20life%20easier." rel="nofollow" title="Blend this!">Blend this!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/c7dad_IolpH500vFs" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-php-code-snippets-for-working-with-strings/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Best practices for coding HTML emails</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/best-practices-for-coding-html-emails/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/best-practices-for-coding-html-emails/#comments</comments>
		<pubDate>Mon, 24 May 2010 18:51:30 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[animated gifs]]></category>
		<category><![CDATA[email clients]]></category>
		<category><![CDATA[french tv]]></category>
		<category><![CDATA[funky fonts]]></category>
		<category><![CDATA[gradients]]></category>
		<category><![CDATA[html email]]></category>
		<category><![CDATA[PSD]]></category>
		<category><![CDATA[waste of money]]></category>
		<category><![CDATA[waste of time]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/best-practices-for-coding-html-emails/</guid>
		<description><![CDATA[Keep it simple and lightweight If you have to remember only one of all the tips I&#8217;m going to give you in this post, it should be this one. In fact, an html email is not a website, so you shouldn&#8217;t try to embed a website into an email. Some years ago, I used to [...]]]></description>
			<content:encoded><![CDATA[<h2>Keep it simple and lightweight</h2>
<p>If you have to remember only one of all the tips I&#8217;m going to give you in this post, it should be this one. In fact, an html email is not a website, so you shouldn&#8217;t try to embed a website into an email.</p>
<p>Some years ago, I used to work for a French TV channel and I often had to slice some PSD&#8217;s into html emails. The PSD&#8217;s contained gradients, funky fonts, and even animated gifs. As a result, the work (despite all efforts I&#8217;ve put in it) looked different from one email client to another, the fonts had to be replaced by Arial, and the whole email was extremely heavy and highly relied on images.</p>
<p>On the other hand, a simple html email will loaded smoothly, and will be more pleasant to read.</p>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/631e6_email.png" alt="" /></p>
<h2>Don&#8217;t abuse images</h2>
<p>An image is worth a thousand words, but it may also take forever to load. I have received many emails that consisted of a few lines of text and nothing else but big images. As a result, the recipient had to wait until the image was loaded (Which can sometimes takes up to 5 seconds!) in order to read the information embedded in the email.</p>
<p>This is, in my opinion, a waste of time for the recipient, as well as a waste of money for the sender: Most people won&#8217;t wait 5 seconds in order to have the big image you send them loaded. They&#8217;ll trash the email. It&#8217;s as simple as that.</p>
<p>An html email should be beautiful and pleasurable to view, but don&#8217;t over do it. Like I&#8217;ve just said, keep it simple, you won&#8217;t regret it.</p>
<h2>Work with tables</h2>
<p>As many email clients handle CSS worst than IE6 (Yes, I&#8217;m not joking), you shouldn&#8217;t even try to make advanced layouts using CSS. Instead, you should do a jump 10 years ago and say hello to <em>tables</em>, <em>tr</em>&#8217;s and <em>td</em>&#8217;s again.</p>
<p>If you&#8217;re like me, you&#8217;re a CSS fan, and this might sound very frustrating. In fact, having to code the dirty way is never pleasant, but you don&#8217;t have much of a choice. Do not hesitate to test by yourself: Chances are that you&#8217;ll soon be using tables again.</p>
<h2>Always use images from your server</h2>
<p>Among html email worst practices I ever saw, embedding images directly in the email definitely arrived at good place. This is wrong in many points: First, it will make the email heavier (I&#8217;ve seen 300ko messages!), and secondly, there&#8217;s a strong risk that the recipient email client block those images.</p>
<p>What you should do is to create a hierarchy of directories on your server, for example <em>Newsletters</em> and then <em>May_2010</em>, and upload images for your html email in it. Once done, simply call them using absolute url paths:</p>
<pre>&lt;img src="http://www.catswhocode.com/images/cat.jpg" alt="A cat" /&gt;</pre>
<h2>Write your CSS inline and use html attributes</h2>
<p>In email clients, the lack of CSS support is definitely something to keep in mind. Don&#8217;t try linking to an external CSS file, and try to avoid as many CSS declarations as possible in the &lt;head&gt; section of your document.</p>
<p>It may be dirty, but the best way to make sure your CSS will be (quite) correctly interpreted by the recipient&#8217;s client is to code your CSS the inline way, as shown in the example below:</p>
<pre>&lt;p style="background:#069; color: white;"&gt;A new background and font color with inline CSS&lt;/p&gt;</pre>
<p>Another &#8220;dirty but effective&#8221; option to consider is the use of html attributes, such as <em>background</em> or <em>bgcolor</em>:</p>
<pre>&lt;body bgcolor="#069"&gt;</pre>
<h2>Don&#8217;t forget the text format</h2>
<p>It may seems a bit obsolete in 2010, but many people, including myself, prefers the good old &#8220;plain text&#8221; format than html emails.  When creating an email list subscription form, try to allow the visitor to choose between the html and plain text format.</p>
<h2>Make sure your emails display in various clients</h2>
<p>When creating a website, any serious developer will test its render on various browsers. This should be the same with html emails: people use a wide variety of clients and in order to be professional you should try to support most of them.</p>
<p>In my opinion, the following clients should be supported: Gmail, Yahoo mail, Mozilla Thunderbird, Apple Mail and Microsoft Outlook. below, you&#8217;ll find two great guides about CSS in html emails:</p>
<ul>
<li><strong><a href="http://www.campaignmonitor.com/css/">Guide to CSS support in email clients</a>: </strong>A very interesting guide describing which CSS properties can be used depending on the user&#8217;s email client. PDF and Excel versions are downloadable.</li>
<li><strong><a href="http://www.campaignmonitor.com/blog/post/3107/css3-support-in-email-clients">CSS3 support in email clients</a> :</strong> Enjoying CSS3? Here&#8217;s another great resource brought to you by Campaign Monitor, showing the few CSS3 properties you can already use in your html emails.</li>
</ul>
<h2>Use Google Analytics to track conversions</h2>
<p>Sending a good html email is definitely a great thing, but your goal is to have people click on it and visit your site. There&#8217;s lots of way to track clicks on emails, but one of the easiest is to use Google Analytics, that you&#8217;re probably already using on your website.</p>
<p>I&#8217;ve never been a big email list sender so I never experimented with Google Analytics conversion tracking. Though, it looks like doing so is very easy: All you have to do is to add some GET parameters to your links, as shown in the example below:</p>
<pre>&lt;a href="http://www.mysite.com/page.php?utm_campaign=fall-sale&amp;utm_medium=email&amp;utm_source=female-list"&gt;Click here&lt;/a&gt;</pre>
<p>However, if you want to know more about click tracking using Google Analytics, you should have a look at <a href="http://cutroni.com/blog/2008/11/04/email-tracking-with-google-analytics/">this article</a>.</p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/best-practices-for-coding-html-emails">Best practices for coding HTML emails</a></p>
<div>
<ul>
<li> <a href="http://delicious.com/post?url=http://www.catswhocode.com/blog/best-practices-for-coding-html-emails&amp;title=Best+practices+for+coding+HTML+emails" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/best-practices-for-coding-html-emails&amp;title=Best+practices+for+coding+HTML+emails&amp;body=Even%20if%20you%27re%20able%20to%20code%20complex%20website%20layouts%2C%20coding%20an%20html%20email%20is%20a%20hard%20job%20and%20there%27s%20lots%20of%20things%20to%20take%20into%20consideration.%20This%20article%20features%20the%20most%20important%20things%20I%27ve%20learned%20in%205%20years%20of%20coding%20html%20emails." rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/best-practices-for-coding-html-emails&amp;title=Best+practices+for+coding+HTML+emails" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/best-practices-for-coding-html-emails&amp;title=Best+practices+for+coding+HTML+emails" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.catswhocode.com/blog/best-practices-for-coding-html-emails&amp;t=Best+practices+for+coding+HTML+emails" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/best-practices-for-coding-html-emails&amp;title=Best+practices+for+coding+HTML+emails&amp;body=Even%20if%20you%27re%20able%20to%20code%20complex%20website%20layouts%2C%20coding%20an%20html%20email%20is%20a%20hard%20job%20and%20there%27s%20lots%20of%20things%20to%20take%20into%20consideration.%20This%20article%20features%20the%20most%20important%20things%20I%27ve%20learned%20in%205%20years%20of%20coding%20html%20emails." rel="nofollow" title="Blend this!">Blend this!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/631e6_uWNtAkJbo5k" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/best-practices-for-coding-html-emails/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Thematic WordPress Theme Toolbox: 10 extremely useful hooks</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/thematic-wordpress-theme-toolbox-10-extremely-useful-hooks/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/thematic-wordpress-theme-toolbox-10-extremely-useful-hooks/#comments</comments>
		<pubDate>Tue, 18 May 2010 17:15:26 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[content themes]]></category>
		<category><![CDATA[css href]]></category>
		<category><![CDATA[favicon]]></category>
		<category><![CDATA[handy code]]></category>
		<category><![CDATA[html xmlns]]></category>
		<category><![CDATA[images directory]]></category>
		<category><![CDATA[png file]]></category>
		<category><![CDATA[strict dtd]]></category>
		<category><![CDATA[theme directory]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/thematic-wordpress-theme-toolbox-10-extremely-useful-hooks/</guid>
		<description><![CDATA[If you&#8217;re looking for a tutorial on how to create a Thematic child theme, you should read this post. Add a favicon A favicon is a small image displayed by modern web browsers. It is a must have for all websites, because it allows your visitors to quickly visualize your site among others when they [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re looking for a tutorial on how to create a Thematic child theme, you should read <a href="http://www.catswhocode.com/blog/wordpress-how-to-easily-create-a-thematic-child-theme">this post</a>.</p>
<h2>Add a favicon</h2>
<p>A favicon is a small image displayed by modern web browsers. It is a must have for all websites, because it allows your visitors to quickly visualize your site among others when they have lots of browser tabs open at the same time.<br /> This handy code will add your favicon to your theme. Make sure a favicon.png file is in your child theme images directory, and then paste the code in your functions.php file:</p>
<pre>function childtheme_favicon() { ?&gt;
	&lt;link rel="shortcut icon" href="&lt;?php echo bloginfo('stylesheet_directory') ?&gt;/images/favicon.png" /&gt;
&lt;?php }
add_action('wp_head', 'childtheme_favicon');</pre>
<p><strong>Source: <a></a></strong></p>
<h2>Add an Internet Explorer specific stylesheet</h2>
<p>Who doesn&#8217;t hate Internet Explorer? Unfortunately, most clients will require developers to make their site IE-compliant. And the best way to do so is to use some conditional comments and a dedicated stylesheet.<br /> Create a file named ie.css in your child theme directory, and then insert the following code in your functions.php file:</p>
<pre>function childtheme_ie_style() { ?&gt;
	&lt;!--[if IE]&gt;
		&lt;link rel="stylesheet" type="text/css" href="http://www.webdevcat.com/wp-content/themes/webdevcat/ie.css" /&gt;
	&lt;![endif]--&gt;
&lt;?php }
add_action('wp_head', 'childtheme_ie_style');</pre>
<h2>Modify Doctype</h2>
<p>By default, Thematic outputs a XHTML 1.0 transitional doctype. If for some reason, you prefer using another kind of doctype, pasting the code below in your functions.php will do the trick.</p>
<pre>function childtheme_create_doctype($content) {
 $content = '&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;';
 $content .= "\n";
 $content .= '&lt;html xmlns="http://www.w3.org/1999/xhtml"';
 return $content;
}
add_filter('thematic_create_doctype', 'childtheme_create_doctype');</pre>
<h2>Use Feedburner RSS feeds</h2>
<p>Feedburner is very popular among bloggers. If you want to replace default rss feeds by feedburner feeds in Thematic, this code is for you.</p>
<pre>function childtheme_rssfeeds($content) {
	$content = "\t";
	$content .= "&lt;link rel=\"alternate\" type=\"application/rss+xml\" href=\"";
	$content .= "http://feeds2.feedburner.com/Catswhocode";
	$content .= "\" title=\"";
	$content .= wp_specialchars(get_bloginfo('name'), 1);
	$content .= " " . __('RSS feed', 'thematic');
	$content .= "\" /&gt;";
	$content .= "\n";
	return $content;
}
add_filter('thematic_rss', 'childtheme_rssfeeds');</pre>
<h2>Add Google Analytics code to your Thematic child theme</h2>
<p>Google Analytics is another free and very useful service. In order to allow GA to collect your visitor information and create your stats, you have to insert a small piece of Javascript on your footer.php file.<br /> Insert this code in your functions.php file, save it, and you&#8217;re done. Of course, don&#8217;t forget to replace the Google Analytics code with your own!</p>
<pre>function ga(){ ?&gt;
	&lt;script type="text/javascript"&gt;
	var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
	document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
	&lt;/script&gt;
	&lt;script type="text/javascript"&gt;
	try {
	var pageTracker = _gat._getTracker("UA-XXXXX-10");
	pageTracker._trackPageview();
	} catch(err) {}&lt;/script&gt;
&lt;?php }
add_action('wp_footer', 'ga');</pre>
<h2>Modify Thematic footer credit</h2>
<p>If you&#8217;re building a Thematic child theme for a client, you may want to insert your credit link in the footer text. The following code will do it. Don&#8217;t forget to give credit to Ian Stewart for his awesome work on the Thematic theme framework!</p>
<pre>function my_footer($thm_footertext) {
	$thm_footertext = 'Copyright &amp;copy; 2010 Jean-Baptiste Jung. &lt;a href="http://www.webdevcat.com"&gt;WebDevCat.com&lt;/a&gt; is obviously powered by &lt;a href="http://www.wordpress.org"&gt;WordPress&lt;/a&gt; &amp;amp; the &lt;a href="http://www.themeshaper.com/thematic"&gt;Thematic Theme framework&lt;/a&gt;.';
	return $thm_footertext;
}
add_filter('thematic_footertext', 'my_footer');</pre>
<h2>Display Thematic menu above header</h2>
<p>Want to have your navigation menu above your site header? That&#8217;s not a problem. This code will remove the menu from below the header and then put it above it.</p>
<pre>function remove_thematic_actions() {
    remove_action('thematic_header','thematic_access',9);
    add_action('thematic_aboveheader','search_access',9);
}
add_action('wp','remove_thematic_actions');</pre>
<h2>Change &#8220;more&#8221; link text</h2>
<p>Thematic &#8220;Read More&#8221; link displays <em>Read More »</em> by default. The following code allow you to change the &#8220;Read More&#8221; text.</p>
<pre>function childtheme_more_text($content) {
	$content = 'Click to read the rest!';
	return $content;
}
add_filter('more_text', 'childtheme_more_text');</pre>
<h2>Change gravatar size in Thematic comments</h2>
<p>By default, Thematic displays 35px*35px gravatars. If you want to change this size, no problem: Just paste this code in, as usual, your beloved functions.php file.</p>
<pre>function childtheme_avatarsize() {
    return '56';
}
add_action( 'avatar_size', 'childtheme_avatarsize' );</pre>
<p><strong>Source: <a href="http://themeshaper.com/forums/topic/on-using-avatars-in-thematic">http://themeshaper.com/forums/topic/on-using-avatars-in-thematic</a></strong></p>
<h2>Remove Thematic menu on specific page template</h2>
<p>If you want to make a squeeze page on your site or blog using Thematic, that&#8217;s quite easy: You only have to create a page template and remove the menu. To do so, just paste the code below in your functions.php file.<br /> Don&#8217;t forget to set your page template name on line 2.</p>
<pre>function remove_access() {
    if (is_page_template('affiliate.php')) {
        remove_action('thematic_header','thematic_access',9);
    }

add_action('wp_head','remove_access');
}</pre>
<p><strong>Source: <a href="http://themeshaper.com/forums/topic/conditionally-removing-thematic_access">http://themeshaper.com/forums/topic/conditionally-removing-thematic_access</a></strong></p>
<p><strong><em>By the way, if you&#8217;re interested in Thematic Theme help, don&#8217;t hesitate to <a href="http://www.catswhocode.com/blog/contact">ask me</a>. I just started freelancing and I&#8217;m ready to help you for a reasonable price.</em></strong></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/thematic-wordpress-theme-toolbox-10-extremely-useful-hooks">Thematic WordPress Theme Toolbox: 10 extremely useful hooks</a></p>
<div>
<ul>
<li> <a href="http://delicious.com/post?url=http://www.catswhocode.com/blog/thematic-wordpress-theme-toolbox-10-extremely-useful-hooks&amp;title=Thematic+WordPress+Theme+Toolbox%3A+10+extremely+useful+hooks" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/thematic-wordpress-theme-toolbox-10-extremely-useful-hooks&amp;title=Thematic+WordPress+Theme+Toolbox%3A+10+extremely+useful+hooks" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.stumbleupon.com/submit?url=http://www.catswhocode.com/blog/thematic-wordpress-theme-toolbox-10-extremely-useful-hooks&amp;title=Thematic+WordPress+Theme+Toolbox%3A+10+extremely+useful+hooks" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/thematic-wordpress-theme-toolbox-10-extremely-useful-hooks&amp;title=Thematic+WordPress+Theme+Toolbox%3A+10+extremely+useful+hooks" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/thematic-wordpress-theme-toolbox-10-extremely-useful-hooks&amp;title=Thematic+WordPress+Theme+Toolbox%3A+10+extremely+useful+hooks&amp;body=If%20you%27re%20looking%20for%20a%20tutorial%20on%20how%20to%20create%20a%20Thematic%20child%20theme%2C%20you%20should%20read%20this%20post.%0D%0A%0D%0AAdd%20a%20favicon%0D%0AA%20favicon%20is%20a%20small%20image%20displayed%20by%20modern%20web%20browsers.%20It%20is%20a%20must%20have%20for%20all%20websites%2C%20because%20it%20allows%20your%20visitors%20to%20quickly%20visualize%20your%20site%20among%20others%20when%20the" rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://www.catswhocode.com/blog" rel="nofollow" title=""></a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/thematic-wordpress-theme-toolbox-10-extremely-useful-hooks&amp;title=Thematic+WordPress+Theme+Toolbox%3A+10+extremely+useful+hooks&amp;body=If%20you%27re%20looking%20for%20a%20tutorial%20on%20how%20to%20create%20a%20Thematic%20child%20theme%2C%20you%20should%20read%20this%20post.%0D%0A%0D%0AAdd%20a%20favicon%0D%0AA%20favicon%20is%20a%20small%20image%20displayed%20by%20modern%20web%20browsers.%20It%20is%20a%20must%20have%20for%20all%20websites%2C%20because%20it%20allows%20your%20visitors%20to%20quickly%20visualize%20your%20site%20among%20others%20when%20the" rel="nofollow" title="Blend this!">Blend this!</a></li>
<li> <a href="http://reddit.com/submit?url=http://www.catswhocode.com/blog/thematic-wordpress-theme-toolbox-10-extremely-useful-hooks&amp;title=Thematic+WordPress+Theme+Toolbox%3A+10+extremely+useful+hooks" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a></li>
<li> <a href="http://twitter.com/home?status=Thematic+WordPress+Theme+Toolbox%3A+10+extremely+useful+hooks+-+http://tinyurl.com/25qmamh+(via+@catswhocode)&amp;source=shareaholic" rel="nofollow" title="Tweet This!">Tweet This!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/3c02e__UFgnQ212rE" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/thematic-wordpress-theme-toolbox-10-extremely-useful-hooks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10 sites developers should have in their bookmarks</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-sites-developers-should-have-in-their-bookmarks/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-sites-developers-should-have-in-their-bookmarks/#comments</comments>
		<pubDate>Tue, 11 May 2010 01:28:58 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[code snippets]]></category>
		<category><![CDATA[format date]]></category>
		<category><![CDATA[gnu linux]]></category>
		<category><![CDATA[handy website]]></category>
		<category><![CDATA[javascript library]]></category>
		<category><![CDATA[linux visit]]></category>
		<category><![CDATA[php forms]]></category>
		<category><![CDATA[script tag]]></category>
		<category><![CDATA[time gain]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-sites-developers-should-have-in-their-bookmarks/</guid>
		<description><![CDATA[Mysql Format Date MySQL Format Date helps you to format your dates using the MySQL DATE_FORMAT function. Just select a common date format and then change it to your suit your needs. The MySQL DATE_FORMAT code will be generated at the bottom of the page which you can then copy into your query. Visit site: [...]]]></description>
			<content:encoded><![CDATA[<h2>Mysql Format Date</h2>
<p>MySQL Format Date helps you to format your dates using the MySQL DATE_FORMAT function.  Just select a common date format and then change it to your suit your needs. The MySQL DATE_FORMAT code will be generated at the bottom of the page which you can then copy into your query.<img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/3cf15_mysql.png" alt="" /><br /> <strong>Visit site: <a href="http://www.mysqlformatdate.com/">http://www.mysqlformatdate.com</a></strong></p>
<h2>Script Src</h2>
<p>Are you tired of hunting the Internet in order to find the script tag for the latest version of the Javascript library of your choice? ScriptSrc.net has compiled all the latest versions of jQuery, Mootools, Prototype and more in a single page which lets you copy it in your browser clipboard with a single click.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/69732_scriptsrc.png" alt="" /><br /> <strong>Visit site: <a href="http://scriptsrc.net/">http://scriptsrc.net</a></strong></p>
<h2>Em Chart</h2>
<p>I never been a fan of <em>ems</em> in CSS files, but sometimes you have to deal with it. In that case, Em chart will translate ems to pixels so you&#8217;ll save time and hassle.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/ce626_emchart.png" alt="" /><br /> <strong>Visit site: <a href="http://aloestudios.com/tools/emchart">http://aloestudios.com/tools/emchart</a></strong></p>
<h2>Twitter API Explorer</h2>
<p>If you&#8217;re using the Twitter API in the site you build, you&#8217;ll for sure enjoy this very handy website which allow you to search through the Twitter API. Even better, the website can generate ready-to-use code snippets. A real time gain for you and your clients!<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/72c3b_twitterapi.png" alt="" /><br /> <strong>Visit site: <a href="http://twitapi.com/explore">http://twitapi.com/explore</a></strong></p>
<h2>Browser Sandbox</h2>
<p>Cross browser compatibility is definitely one of the biggest problems a web developer has to face in his daily job. The browser sandbox lets you run any Windows browser from the web. The only bad thing is that you must run a Windows machine: The app does not work on Macs and GNU/Linux.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/97764_spoon.png" alt="" /><br /> <strong>Visit site: <a href="http://spoon.net/browsers/">http://spoon.net/browsers</a></strong></p>
<h2>PHP Forms</h2>
<p>Web forms are one of the most important part of a website, but creating them is also very time-consuming. So, what about using a website that can speed up your form development for free?<br /> PHP forms allows you to create advanced forms that can fit the needs of most websites.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/b7905_phpforms.png" alt="" /><br /> <strong>Visit site: <a href="http://www.phpform.org">http://www.phpform.org</a></strong></p>
<h2>.htaccess editor</h2>
<p>A .htaccess file is a must have for any website. Don&#8217;t know how to write one? No problem, just visit this site to create your .htaccess file using a wizard. It doesn&#8217;t allow very advanced stuff, but the results are great for 95% of the websites you&#8217;ll make.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/bb9b3_htaccess.png" alt="" /><br /> <strong>Visit site: <a href="http://www.htaccesseditor.com/en.shtml">http://www.htaccesseditor.com/en.shtml</a></strong></p>
<h2>Smush it!</h2>
<p>Images may be worth a thousand words, they&#8217;re also well known to use a lot of bandwidth. Images can be optimized for the web using programs like Photoshop; but if you don&#8217;t own a copy of this software or simply don&#8217;t have a clue how to do it, smush.it is what you need.<br /> Brought to you by Yahoo developers network, Smush.it is an online tool that will reduce your image size without reducing their quality. For WordPress users, a very handy plugin for your favorite blogging engine is available <a href="http://wordpress.org/extend/plugins/wp-smushit/">here</a>.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/69b7f_smushit.png" alt="" /><br /> <strong>Visit site: <a href="http://developer.yahoo.com/yslow/smushit/">http://developer.yahoo.com/yslow/smushit/</a></strong></p>
<h2>CSS Compressor</h2>
<p>Especially on site with many different page layouts, CSS files can become huge and use a lot of server bandwidth. This tool, named CSS Compressor, can consequently reduce the size of any CSS file by removing comments, indentation and more.<br /> Even better, compression level can be configured to fit your needs.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/8d738_csscompressor.png" alt="" /><br /> <strong>Visit site: <a href="http://www.csscompressor.com">http://www.csscompressor.com</a></strong></p>
<h2>Test everything</h2>
<p>This site is a definitive must-have for your bookmarks: As the name says, Test everything allows you to test lot of things such as XHTML and CSS markup, PageRank, back-links, and a lot more.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/5eeee_testeverything.png" alt="" /><br /> <strong>Visit site: <a href="http://tester.jonasjohn.de">http://tester.jonasjohn.de</a></strong></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/10-sites-developers-should-have-in-their-bookmarks">10 sites developers should have in their bookmarks</a></p>
<div>
<ul>
<li> <a href="http://delicious.com/post?url=http://www.catswhocode.com/blog/10-sites-developers-should-have-in-their-bookmarks&amp;title=10+sites+developers+should+have+in+their+bookmarks" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/10-sites-developers-should-have-in-their-bookmarks&amp;title=10+sites+developers+should+have+in+their+bookmarks" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.stumbleupon.com/submit?url=http://www.catswhocode.com/blog/10-sites-developers-should-have-in-their-bookmarks&amp;title=10+sites+developers+should+have+in+their+bookmarks" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/10-sites-developers-should-have-in-their-bookmarks&amp;title=10+sites+developers+should+have+in+their+bookmarks" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/10-sites-developers-should-have-in-their-bookmarks&amp;title=10+sites+developers+should+have+in+their+bookmarks&amp;body=Mysql%20Format%20Date%0D%0AMySQL%20Format%20Date%20helps%20you%20to%20format%20your%20dates%20using%20the%20MySQL%20DATE_FORMAT%20function.%20%20Just%20select%20a%20common%20date%20format%20and%20then%20change%20it%20to%20your%20suit%20your%20needs.%20The%20MySQL%20DATE_FORMAT%20code%20will%20be%20generated%20at%20the%20bottom%20of%20the%20page%20which%20you%20can%20then%20copy%20into%20your%20query.%0D%0AVis" rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://www.catswhocode.com/blog" rel="nofollow" title=""></a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/10-sites-developers-should-have-in-their-bookmarks&amp;title=10+sites+developers+should+have+in+their+bookmarks&amp;body=Mysql%20Format%20Date%0D%0AMySQL%20Format%20Date%20helps%20you%20to%20format%20your%20dates%20using%20the%20MySQL%20DATE_FORMAT%20function.%20%20Just%20select%20a%20common%20date%20format%20and%20then%20change%20it%20to%20your%20suit%20your%20needs.%20The%20MySQL%20DATE_FORMAT%20code%20will%20be%20generated%20at%20the%20bottom%20of%20the%20page%20which%20you%20can%20then%20copy%20into%20your%20query.%0D%0AVis" rel="nofollow" title="Blend this!">Blend this!</a></li>
<li> <a href="http://reddit.com/submit?url=http://www.catswhocode.com/blog/10-sites-developers-should-have-in-their-bookmarks&amp;title=10+sites+developers+should+have+in+their+bookmarks" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a></li>
<li> <a href="http://twitter.com/home?status=10+sites+developers+should+have+in+their+bookmarks+-+http://tinyurl.com/26qym6h+(via+@catswhocode)&amp;source=shareaholic" rel="nofollow" title="Tweet This!">Tweet This!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/5eeee_RC5KRk2y90s" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-sites-developers-should-have-in-their-bookmarks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Top WordPress hacks of early 2010</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/top-wordpress-hacks-of-early-2010/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/top-wordpress-hacks-of-early-2010/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 18:24:27 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[amp]]></category>
		<category><![CDATA[contributor]]></category>
		<category><![CDATA[current user]]></category>
		<category><![CDATA[dashboard]]></category>
		<category><![CDATA[files source]]></category>
		<category><![CDATA[function php]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[incr]]></category>
		<category><![CDATA[Posti]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/top-wordpress-hacks-of-early-2010/</guid>
		<description><![CDATA[Display an incrementing number on each post I always loved how A List Apart numbers its posts. The following hack will let you do the same with your own blog, using a custom field. Implementing this hack is quite simple. First, paste the following function into your functions.php file: function updateNumbers() { global $wpdb; $querystr [...]]]></description>
			<content:encoded><![CDATA[<h2>Display an incrementing number on each post</h2>
<p>I always loved how <a href="http://www.alistapart.com/">A List Apart</a> numbers its posts. The following hack will let you do the same with your own blog, using a custom field.</p>
<p>Implementing this hack is quite simple. First, paste the following function into your functions.php file:</p>
<pre>function updateNumbers() {
  global $wpdb;
  $querystr = "SELECT $wpdb-&gt;posts.* FROM $wpdb-&gt;posts WHERE $wpdb-&gt;posts.post_status = 'publish' AND $wpdb-&gt;posts.post_type = 'post' ";
$pageposts = $wpdb-&gt;get_results($querystr, OBJECT);
  $counts = 0 ;
  if ($pageposts):
    foreach ($pageposts as $post):
      setup_postdata($post);
      $counts++;
      add_post_meta($post-&gt;ID, 'incr_number', $counts, true);
      update_post_meta($post-&gt;ID, 'incr_number', $counts);
    endforeach;
  endif;
}  

add_action ( 'publish_post', 'updateNumbers' );
add_action ( 'deleted_post', 'updateNumbers' );
add_action ( 'edit_post', 'updateNumbers' );</pre>
<p>Once done, you can display the post number with the following code. Note that it have to be used within the loop.</p>
<pre>&lt;?php echo get_post_meta($post-&gt;ID,'incr_number',true); ?&gt;</pre>
<p><strong>Source: <a href="http://www.wprecipes.com/how-to-display-an-incrementing-number-next-to-each-published-post">http://www.wprecipes.com/how-to-display-an-incrementing-number-next-to-each-published-post</a></strong></p>
<h2>Allow your contributors to upload files</h2>
<p>If you&#8217;re like me, you have guest contributing articles on your blog and you might be annoyed that the contributor role doesn&#8217;t allow file uploads. Most blog posts need images to stand out of the crowd so<br /> this hack is extremely handy: Just paste it on your function.php file and your contributors will be allowed to upload files in the WordPress dashboard. How cool is that?</p>
<pre>if ( current_user_can('contributor') &amp;&amp; !current_user_can('upload_files') )
    add_action('admin_init', 'allow_contributor_uploads');

function allow_contributor_uploads() {
    $contributor = get_role('contributor');
    $contributor-&gt;add_cap('upload_files');
}</pre>
<p><strong>Source: <a href="http://www.wprecipes.com/wordpress-tip-allow-contributors-to-upload-files">http://www.wprecipes.com/wordpress-tip-allow-contributors-to-upload-files</a></strong></p>
<h2>Display &#8220;time ago&#8221; dates</h2>
<p>Twitter has a very cool function which displays the elapsed time since a tweet has been published. What about doing the same with WordPress? Of course it&#8217;s possible!<br /> This code just needs to be pasted in your functions.php file. Once you saved the file, posts that were published less than 24 hours ago will display &#8220;Published XX ago&#8221; instead of regular dates.</p>
<pre>add_filter('the_time', 'timeago');

function timeago() {
    global $post;
    $date = $post-&gt;post_date;
    $time = get_post_time('G', true, $post);
    $time_diff = time() - $time;
    if ( $time_diff &gt; 0 &amp;&amp; $time_diff &lt; 24*60*60 )
        $display = sprintf( __('%s ago'), human_time_diff( $time ) );
    else
        $display = date(get_option('date_format'), strtotime($date) );

    return $display;
}</pre>
<p>By the way, if you&#8217;re on Twitter do not hesitate to <a href="http://www.twitter.com/catswhocode">follow me</a>!<br /> <strong>Source: <a href="http://aext.net/2010/04/display-timeago-for-wordpress-if-less-than-24-hours/">http://aext.net/2010/04/display-timeago-for-wordpress-if-less-than-24-hours/</a></strong></p>
<h2>WordPress navigation outside the loop</h2>
<p>WordPress provides some functions which allow you to link to the next and previous posts. However, those functions have to be used within the loop. Jeff Starr, who wrote the <a href="http://www.catswhocode.com/blog/diw.html" target="blank">Digging into WordPress</a> book, has the solution to this problem.<br /> Simply paste the code below on your single.php file, where you&#8217;d like to link to the next and previous posts. Or even better, put the code in a php file and then include it in your theme file.</p>
<pre>&lt;?php if(is_single()) { // single-view navigation ?&gt;
	&lt;?php $posts = query_posts($query_string); if (have_posts()) : while (have_posts()) : the_post(); ?&gt;
		&lt;?php previous_post_link(); ?&gt; | &lt;?php next_post_link(); ?&gt;
	&lt;?php endwhile; endif; ?&gt;
&lt;?php } else { // archive view navigation ?&gt;
		&lt;?php posts_nav_link(); ?&gt;
&lt;?php } ?&gt;</pre>
<p><strong>Source: <a href="http://digwp.com/2010/04/post-navigation-outside-loop/">http://digwp.com/2010/04/post-navigation-outside-loop/</a></strong></p>
<h2>Disallow theme switching</h2>
<p>If you&#8217;re like me, you&#8217;ve created WordPress themes for your clients and already face a problem: The client &#8220;explored&#8221; the WordPress dashboard and &#8220;accidentally&#8221; switched the theme.<br /> Using WordPress actions, we can easily remove the &#8220;themes&#8221; menu and consequently prevent the risk of having a client switching the theme. The code below just has to be pasted in your functions.php. The &#8220;themes&#8221; menu will be removed once the file is saved.</p>
<pre>add_action('admin_init', 'remove_theme_menus');
function remove_theme_menus() {
	global $submenu;	

	unset($submenu['themes.php'][5]);
	unset($submenu['themes.php'][15]);
}</pre>
<p><strong>Source: <a href="http://soulsizzle.com/quick-tips/stopping-clients-from-switching-their-wordpress-theme/">http://soulsizzle.com/quick-tips/stopping-clients-from-switching-their-wordpress-theme/</a></strong></p>
<h2>Get rid of unused shortcodes in your posts</h2>
<p>WordPress shortcodes are extremely useful, but they have a weak point: If you use a shortcode in your posts and then stop to use it for some reason, the shortcode code (Like <em>[shortcode]</em> for example) will stay in your posts.</p>
<p>To get rid of unused shortcodes, you just have to execute this line of SQL code. This can be done using PhpMyAdmin or the SQL command line interpreter. Don&#8217;t forget to replace <em>[tweet]</em> by the unused shortcode you&#8217;d like to delete from your posts.</p>
<pre>UPDATE wp_post SET post_content = replace(post_content, '[tweet]', '' );</pre>
<p><strong>Source: <a href="http://www.wprecipes.com/wordpress-tip-get-rid-of-unused-shortcodes">http://www.wprecipes.com/wordpress-tip-get-rid-of-unused-shortcodes</a></strong></p>
<h2>Switch WordPress theme programmatically</h2>
<p>Recently, I worked on an interesting project where I had to switch the blog theme automatically. As the current WordPress theme name is saved in the wp_options table of your WordPress database, we can easily change it.<br /> The cleanest way to do it is definitely to use the <em>update_option() </em>function, as shown in the function below. Paste it in your functions.php file.</p>
<pre>function updateTheme($theme){
    update_option('template', $theme);
    update_option('stylesheet', $theme);
    update_option('current_theme', $theme);
}</pre>
<p>Once you&#8217;ve added the function to your functions.php file, you can call it wherever you need it:</p>
<pre>&lt;php updateTheme('default'); ?&gt;</pre>
<h2>Modify WordPress dashboard footer text</h2>
<p>Another good tip for those who create WordPress themes for clients is to modify the WordPress dashboard footer text, and add (for example) a link to your support forum. The only thing you have to do is to copy this code and paste it in functions.php:</p>
<pre>function remove_footer_admin () {
    echo "Your own text";
} 

add_filter('admin_footer_text', 'remove_footer_admin');</pre>
<p><strong>Source: <a href="http://www.wprecipes.com/wordpress-tip-how-to-change-the-dashboard-footer-text">http://www.wprecipes.com/wordpress-tip-how-to-change-the-dashboard-footer-text</a></strong></p>
<h2>Programmatically Creating Posts in WordPress</h2>
<p>If for some reason you need to programmatically insert posts in WordPress database, you&#8217;ll be amazed to see how easy is it. The <em>wp_insert_post()</em> takes an array of data as a parameter, and then return the post ID.</p>
<pre>global $user_ID;
$new_post = array(
'post_title' =&gt; 'My New Post',
'post_content' =&gt; 'Lorem ipsum dolor sit amet...',
'post_status' =&gt; 'publish',
'post_date' =&gt; date('Y-m-d H:i:s'),
'post_author' =&gt; $user_ID,
'post_type' =&gt; 'post',
'post_category' =&gt; array(0)
);
$post_id = wp_insert_post($new_post);</pre>
<p><strong>Source: <a href="http://www.webmaster-source.com/2010/02/09/programmatically-creating-posts-in-wordpress">http://www.webmaster-source.com/2010/02/09/programmatically-creating-posts-in-wordpress</a></strong></p>
<h2>WordPress 3.0: Query custom post types</h2>
<p>WordPress 3.0 should be released soon. And I don&#8217;t know about you, but personally, I can&#8217;t wait. Lots of exiting features are scheduled. One of them is particularly interesting in my opinion: the custom post types, which allow you to define a custom type for a post.<br /> In order to be able to retrieve posts of a specific type from a WordPress database, you can use the following loop, which will get the <em>albums</em> post type:</p>
<pre>&lt;ul&gt;
&lt;?php global $wp_query;
$wp_query = new WP_Query("post_type=albums&amp;post_status=publish");

while ($wp_query-&gt;have_posts()) : $wp_query-&gt;the_post(); ?&gt;
    &lt;li&gt;&lt;a href="&lt;?php the_permalink() ?&gt;" rel="bookmark"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;
&lt;?php endwhile; ?&gt;

&lt;/ul&gt;</pre>
<p><strong>Source: <a href="http://www.catswhocode.com/blog/8-useful-code-snippets-to-get-started-with-wordpress-3-0">http://www.catswhocode.com/blog/8-useful-code-snippets-to-get-started-with-wordpress-3-0</a></strong></p>
<p><strong><em>Please note that I&#8217;m currently accepting freelance work; so if you need any kind of WordPress help, I&#8217;ll be happy to help you. Simply <a href="http://www.catswhocode.com/blog/contact">send me an email</a> and I&#8217;ll get back to you.</em></strong></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/top-wordpress-hacks-of-early-2010">Top WordPress hacks of early 2010</a></p>
<div>
<ul>
<li> <a href="http://delicious.com/post?url=http://www.catswhocode.com/blog/top-wordpress-hacks-of-early-2010&amp;title=Top+WordPress+hacks+of+early+2010" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/top-wordpress-hacks-of-early-2010&amp;title=Top+WordPress+hacks+of+early+2010" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.stumbleupon.com/submit?url=http://www.catswhocode.com/blog/top-wordpress-hacks-of-early-2010&amp;title=Top+WordPress+hacks+of+early+2010" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/top-wordpress-hacks-of-early-2010&amp;title=Top+WordPress+hacks+of+early+2010" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/top-wordpress-hacks-of-early-2010&amp;title=Top+WordPress+hacks+of+early+2010&amp;body=Display%20an%20incrementing%20number%20on%20each%20post%0D%0AI%20always%20loved%20how%20A%20List%20Apart%20numbers%20its%20posts.%20The%20following%20hack%20will%20let%20you%20do%20the%20same%20with%20your%20own%20blog%2C%20using%20a%20custom%20field.%0D%0A%0D%0AImplementing%20this%20hack%20is%20quite%20simple.%20First%2C%20paste%20the%20following%20function%20into%20your%20functions.php%20file%3A%0D%0Afunction" rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://www.catswhocode.com/blog" rel="nofollow" title=""></a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/top-wordpress-hacks-of-early-2010&amp;title=Top+WordPress+hacks+of+early+2010&amp;body=Display%20an%20incrementing%20number%20on%20each%20post%0D%0AI%20always%20loved%20how%20A%20List%20Apart%20numbers%20its%20posts.%20The%20following%20hack%20will%20let%20you%20do%20the%20same%20with%20your%20own%20blog%2C%20using%20a%20custom%20field.%0D%0A%0D%0AImplementing%20this%20hack%20is%20quite%20simple.%20First%2C%20paste%20the%20following%20function%20into%20your%20functions.php%20file%3A%0D%0Afunction" rel="nofollow" title="Blend this!">Blend this!</a></li>
<li> <a href="http://reddit.com/submit?url=http://www.catswhocode.com/blog/top-wordpress-hacks-of-early-2010&amp;title=Top+WordPress+hacks+of+early+2010" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a></li>
<li> <a href="http://twitter.com/home?status=Top+WordPress+hacks+of+early+2010+-+http://tinyurl.com/26j59da+(via+@catswhocode)&amp;source=shareaholic" rel="nofollow" title="Tweet This!">Tweet This!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/dbbbb_3NxTbam7FC4" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/top-wordpress-hacks-of-early-2010/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Manipulating the DOM with jQuery: 10+ useful code snippets</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/manipulating-the-dom-with-jquery-10-useful-code-snippets/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/manipulating-the-dom-with-jquery-10-useful-code-snippets/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 20:49:35 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[addclass]]></category>
		<category><![CDATA[class id]]></category>
		<category><![CDATA[css styles]]></category>
		<category><![CDATA[elementa]]></category>
		<category><![CDATA[img elements]]></category>
		<category><![CDATA[inline styles]]></category>
		<category><![CDATA[lal]]></category>
		<category><![CDATA[parent element]]></category>
		<category><![CDATA[snippets]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/manipulating-the-dom-with-jquery-10-useful-code-snippets/</guid>
		<description><![CDATA[Add a CSS class to a specific element A very clean way to change an element look and feel is to add a css class, instead of adding inline styles. Using jQuery, this is pretty easy to do: $('#myelement').addClass('myclass'); Removing a CSS class from a specific element It&#8217;s great to be able to add some [...]]]></description>
			<content:encoded><![CDATA[<h2>Add a CSS class to a specific element</h2>
<p>A very clean way to change an element look and feel is to add a css class, instead of adding inline styles. Using jQuery, this is pretty easy to do:</p>
<pre>$('#myelement').addClass('myclass');</pre>
<h2>Removing a CSS class from a specific element</h2>
<p>It&#8217;s great to be able to add some CSS classes, but we also need to know how to remove unwanted classes. The following line of code will do that:</p>
<pre>$('#myelement').removeClass('myclass');</pre>
<h2>Check if a specific element has a CSS class</h2>
<p>If your application or site is frequently adding and removing classes to a particular element, it can be very useful to be able to check out if an element has a certain CSS class.</p>
<pre>$(id).hasClass(class)</pre>
<h2>Switch CSS using jQuery</h2>
<p>As we saw with the previous examples, adding or removing css styles to an element is very simple using jQuery. But what if you want to completely remove the document css file and attach a new stylesheet? Good news, it is extremely simple as well, as shown in the following example:</p>
<pre>$('link[media='screen']').attr('href', 'Alternative.css');</pre>
<p><strong>Source: <a href="http://addyosmani.com/blog/50-jquery-snippets-for-developers/">http://addyosmani.com/blog/50-jquery-snippets-for-developers/</a></strong></p>
<h2>Append HTML to an element</h2>
<p>When you need to append some html to an element, the <em>append()</em> method is a life saver:</p>
<pre>$('#lal').append('sometext');</pre>
<h2>Check if an element exists</h2>
<p>When working with Javascript, we often need to check if an element exists or not. Using jQuery and the <em>length</em> property, it is very simple to do: If length == 0, no elements are used on the page. Otherwise, some are used.</p>
<pre>if ($('img').length) {
    log('We found img elements on the page using "img"');
} else {
    log('No img elements found');
}</pre>
<p><strong>Source: <a href="http://jqueryfordesigners.com/element-exists/">http://jqueryfordesigners.com/element-exists/</a></strong></p>
<h2>Get the parent element of an element</h2>
<p>When working with the DOM, you may need to know which element is the direct parent of another element. The <em>closest()</em> method will let you know:</p>
<pre>var id = $("button").closest("div").attr("id");</pre>
<p><strong>Source: <a href="http://stackoverflow.com/questions/545978/finding-the-id-of-a-parent-div-using-jquery">http://stackoverflow.com/questions/545978/finding-the-id-of-a-parent-div-using-jquery</a></strong></p>
<h2>Get element siblings</h2>
<p>The siblings() method is a very handy tool to get siblings of an element. As shown below, using this method is extremely simple:</p>
<pre>$("div").siblings()</pre>
<h2>Remove an option from a select list</h2>
<p>When working with <em>select</em> lists, you may want to update the content according to the user actions. To remove an option from a select list, the following code will do the trick:</p>
<pre>$("#selectList option[value='2']").remove();</pre>
<p><strong>Source: <a href="http://calisza.wordpress.com/2009/03/29/6-jquery-snippets-you-can-use-to-manipulate-select-inputs/">http://calisza.wordpress.com/2009/03/29/6-jquery-snippets-you-can-use-to-manipulate-select-inputs/</a></strong></p>
<h2>Get the selected option as text</h2>
<p>Extremely useful when you need to quickly check out what a visitor selected from your select list.</p>
<pre>$('#selectList :selected').text();</pre>
<h2>Apply a &#8220;zebra&#8221; effect on tables</h2>
<p>When using tables, it is a good idea, for better readability, to give a different style to one line out of two. Using jQuery, this can be done easily, without any additional html markup.</p>
<pre>$("tr:odd").addClass("odd");</pre>
<p><strong>Source: <a href="http://web.enavu.com/tutorials/top-10-jquery-snippets-including-jquery-1-4/">http://web.enavu.com/tutorials/top-10-jquery-snippets-including-jquery-1-4/</a></strong></p>
<h2>Count children of an element</h2>
<p>If you&#8217;d like to count how many <em>div</em> elements are children of <em>#foo</em>, the following line will let you know. Simple and efficient!</p>
<pre>$("#foo &gt; div").length</pre>
<p><strong>Source: <a href="http://tympanus.net/codrops/2010/01/05/some-useful-javascript-jquery-snippets/">http://tympanus.net/codrops/2010/01/05/some-useful-javascript-jquery-snippets/</a></strong></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/manipulating-the-dom-with-jquery-10-useful-code-snippets">Manipulating the DOM with jQuery: 10+ useful code snippets</a></p>
<div>
<ul>
<li> <a href="http://delicious.com/post?url=http://www.catswhocode.com/blog/manipulating-the-dom-with-jquery-10-useful-code-snippets&amp;title=Manipulating+the+DOM+with+jQuery%3A+10%2B+useful+code+snippets" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/manipulating-the-dom-with-jquery-10-useful-code-snippets&amp;title=Manipulating+the+DOM+with+jQuery%3A+10%2B+useful+code+snippets" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.stumbleupon.com/submit?url=http://www.catswhocode.com/blog/manipulating-the-dom-with-jquery-10-useful-code-snippets&amp;title=Manipulating+the+DOM+with+jQuery%3A+10%2B+useful+code+snippets" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/manipulating-the-dom-with-jquery-10-useful-code-snippets&amp;title=Manipulating+the+DOM+with+jQuery%3A+10%2B+useful+code+snippets" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/manipulating-the-dom-with-jquery-10-useful-code-snippets&amp;title=Manipulating+the+DOM+with+jQuery%3A+10%2B+useful+code+snippets&amp;body=Add%20a%20CSS%20class%20to%20a%20specific%20element%0D%0AA%20very%20clean%20way%20to%20change%20an%20element%20look%20and%20feel%20is%20to%20add%20a%20css%20class%2C%20instead%20of%20adding%20inline%20styles.%20Using%20jQuery%2C%20this%20is%20pretty%20easy%20to%20do%3A%0D%0A%24%28%27%23myelement%27%29.addClass%28%27myclass%27%29%3B%0D%0ARemoving%20a%20CSS%20class%20from%20a%20specific%20element%0D%0AIt%27s%20great%20to%20be%20able%20to%20ad" rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://www.catswhocode.com/blog" rel="nofollow" title=""></a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/manipulating-the-dom-with-jquery-10-useful-code-snippets&amp;title=Manipulating+the+DOM+with+jQuery%3A+10%2B+useful+code+snippets&amp;body=Add%20a%20CSS%20class%20to%20a%20specific%20element%0D%0AA%20very%20clean%20way%20to%20change%20an%20element%20look%20and%20feel%20is%20to%20add%20a%20css%20class%2C%20instead%20of%20adding%20inline%20styles.%20Using%20jQuery%2C%20this%20is%20pretty%20easy%20to%20do%3A%0D%0A%24%28%27%23myelement%27%29.addClass%28%27myclass%27%29%3B%0D%0ARemoving%20a%20CSS%20class%20from%20a%20specific%20element%0D%0AIt%27s%20great%20to%20be%20able%20to%20ad" rel="nofollow" title="Blend this!">Blend this!</a></li>
<li> <a href="http://reddit.com/submit?url=http://www.catswhocode.com/blog/manipulating-the-dom-with-jquery-10-useful-code-snippets&amp;title=Manipulating+the+DOM+with+jQuery%3A+10%2B+useful+code+snippets" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a></li>
<li> <a href="http://twitter.com/home?status=Manipulating+the+DOM+with+jQuery%3A+10%2B+useful+code+snippets+-+http://tinyurl.com/y25p9qr+(via+@catswhocode)&amp;source=shareaholic" rel="nofollow" title="Tweet This!">Tweet This!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/199a3_j2Cesj7yTRQ" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/manipulating-the-dom-with-jquery-10-useful-code-snippets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>8 useful code snippets to get started with WordPress 3.0</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-useful-code-snippets-to-get-started-with-wordpress-3-0/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-useful-code-snippets-to-get-started-with-wordpress-3-0/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 14:29:06 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[args]]></category>
		<category><![CDATA[custom categories]]></category>
		<category><![CDATA[dashboard]]></category>
		<category><![CDATA[music albums]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[taxonomies]]></category>
		<category><![CDATA[true capability]]></category>
		<category><![CDATA[true query]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-useful-code-snippets-to-get-started-with-wordpress-3-0/</guid>
		<description><![CDATA[How to create a custom post type Custom post type are an incredible step forward for WordPress, because it will allow developers to create post types according to their needs. For now, we have posts, and pages. With WordPress 3.0, we&#8217;ll be able to create a new post type called products, where a client can [...]]]></description>
			<content:encoded><![CDATA[<h2>How to create a custom post type</h2>
<p>Custom post type are an incredible step forward for WordPress, because it will allow developers to create post types according to their needs.<br /> For now, we have <em>posts</em>, and <em>pages</em>. With WordPress 3.0, we&#8217;ll be able to create a new post type called <em>products</em>, where a client can sell his products only, while regular post for his blog.</p>
<p>Creating a custom post type is easy: All you have to do is to open your theme <em>functions.php</em> file and paste the following:</p>
<pre>$args = array(
        'label' =&gt; __('Products'),
        'singular_label' =&gt; __('Product'),
        'public' =&gt; true,
        'show_ui' =&gt; true,
        'capability_type' =&gt; 'page',
        'hierarchical' =&gt; false,
        'rewrite' =&gt; true,
        'query_var' =&gt; 'products',
        'supports' =&gt; array('title', 'thumbnail')
);
register_post_type( 'album' , $args );</pre>
<p>Once you saved the file, login to your WordPress dashboard and have a look at the navigation on the left: A new post type, named <em>Products</em>, has been added.<br /> <strong>Source: <a href="http://codex.wordpress.org/Function_Reference/register_post_type">http://codex.wordpress.org/Function_Reference/register_post_type</a></strong></p>
<h2>Custom post types with custom taxonomies</h2>
<p>In the previous example, I&#8217;ve shown you how to create a custom post type, which is pretty useful to use WordPress as a real CMS and not a simple blog publishing platform.</p>
<p>Now, let&#8217;s see something a little bit more complex, but extremely interesting: Creating a custom post type associated with custom taxonomies. For those who don&#8217;t know, a taxonomy is a term (such as category, tag or anything else) related to posts. For more information about taxonomies, you should have a look at <a href="http://codex.wordpress.org/WordPress_Taxonomy">WordPress Codex</a>.</p>
<p>In this example, we&#8217;ll create a custom post type named Albums, which belong to &#8220;Genres&#8221; (the custom categories) and have &#8220;Performer&#8221; as tags. This snippet has to be pasted in your <em>functions.php</em> file. With those 27 lines of codes, you can create a fully functional music albums archive. Ain&#8217;t that powerful?</p>
<pre>function post_type_albums() {
	register_post_type(
                     'albums',
                     array('label' =&gt; __('Albums'),
                             'public' =&gt; true,
                             'show_ui' =&gt; true,
                             'supports' =&gt; array(
                                        'post-thumbnails',
                                        'excerpts',
                                        'trackbacks',
                                        'comments')
                                )
                      );
// Adding the Custom Taxonomy for Genres. Here we can create categories specific for this post type.
	register_taxonomy( 'genres', 'albums', array( 'hierarchical' =&gt; true, 'label' =&gt; __('Genres') ) );

// Adding the Custom Taxonomy for Performer. Here we can add tags specific for this post type.
        register_taxonomy( 'performer', 'albums',
		array(
                         'hierarchical' =&gt; false,
			 'label' =&gt; __('Performer'),
			 'query_var' =&gt; 'performer',
			 'rewrite' =&gt; array('slug' =&gt; 'performer' )
		)
	);
}
add_action('init', 'post_type_albums');</pre>
<p><strong>Source: <a href="http://wpspecial.net/2010/03/how-to-add-custom-post-types-in-wordpress/">http://wpspecial.net/2010/03/how-to-add-custom-post-types-in-wordpress/</a></strong></p>
<h2>Query custom post types</h2>
<p>Now that you&#8217;ve learned how to create custom post types, the next step is to learn how to retrieve them from the WordPress database and display it on your blog.</p>
<p>Good news for developers, there&#8217;s nothing hard or new in the process. Custom post types can be retrieved easily, using the WP_Query object.<br /> The following example will create a custom loop which will get only the <em>albums</em> custom post type.</p>
<pre>&lt;ul&gt;

&lt;?php global $wp_query;
$wp_query = new WP_Query("post_type=albums&amp;post_status=publish");

while ($wp_query-&gt;have_posts()) : $wp_query-&gt;the_post(); ?&gt;
    &lt;li&gt;&lt;a href="&lt;?php the_permalink() ?&gt;" rel="bookmark"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;
&lt;?php endwhile; ?&gt;
&lt;/ul&gt;</pre>
<p><strong>Source: <a></a></strong></p>
<h2>Enable multisite feature</h2>
<p>One of the most exiting new feature of WordPress 3.0 is definitely multisite management. In brief, with a single installation of WordPress you&#8217;ll be able to run a network of WordPress blog. How cool is that?</p>
<p>To take advantage of this feature, simply paste the following line of code in your <em>wp-config.php</em> file. This file is located at the root of your WordPress install.</p>
<pre>define('WP_ALLOW_MULTISITE', true);</pre>
<p><strong>Source: <a href="http://wptheming.com/2010/03/wordpress-3-0-enable-network/">http://wptheming.com/2010/03/wordpress-3-0-enable-network/</a></strong></p>
<h2>Custom author profiles</h2>
<p>Most of the top blogs of the industry do not have a single author but a team of different contributors. WordPress allows you to create author pages, but WordPress 3.0 is introducing a new function which will allow you to use different templates for different authors, like we can currently do with categories.</p>
<p>All you have to do is to create an author page named <em>author-XX.php</em> where XX is either the author ID or nicename. For example, if your user nicename is &#8220;john&#8221;, you&#8217;ll have to call the file <em>author-john.php</em>.</p>
<p><strong>Source: <a href="http://codex.wordpress.org/Function_Reference/get_author_template">http://codex.wordpress.org/Function_Reference/get_author_template</a></strong></p>
<h2>Add custom backgrounds</h2>
<p>WordPress 3.0 is introducing a new feature that will for sure be loved by non tech-friendly users: Custom background. The feature allows the user to upload a background in his WordPress dashboard, specify its position, and automatically have it added to his blog.</p>
<p>Of course, the theme used by the blogger has to support this feature, otherwise the uploaded background will not be visible. To do so, simply open your <em>functions.php</em> file and paste the following line:</p>
<pre>add_custom_background();</pre>
<h2>Style WordPress editor using CSS</h2>
<p>WordPress features a WYSIWYG editor, which allow you to see text in bold, italic, and so on. But some people want more, such as being able to visualize their blog post in the blog font and colors.</p>
<p>This new feature allows you to create a css file (named <em>editor-style.css</em> in the example below) and link it to the editor for a better WYSIWYG rendering. Simply paste this code snippet to your <em>functions.php</em> file.</p>
<pre>add_filter('mce_css', 'my_editor_style');
function my_editor_style($url) {
  if ( !empty($url) )
    $url .= ',';
  // Change the path here if using sub-directory
  $url .= trailingslashit( get_stylesheet_directory_uri() ) . 'editor-style.css';

  return $url;
}</pre>
<p><strong>Source: <a href="http://azaozz.wordpress.com/2010/01/02/can-themes-style-the-visual-editor/">http://azaozz.wordpress.com/2010/01/02/can-themes-style-the-visual-editor/</a></strong></p>
<h2>Make your theme compatible with WordPress 3.0 menus</h2>
<p>WordPress 3.0 is going to feature a totally new menu system, which will allow users to add only the desired pages, add categories, and more. Good news for theme developers; adding WP 3.0 menu support to your themes is extremely easy.</p>
<p>To do so, open functions.php and add the following line:</p>
<pre>add_theme_support( 'nav-menus' );</pre>
<p>Once added, you can use the brand new <em>wp_nav_menu()</em> function in your theme files:</p>
<pre>wp_nav_menu('sort_column=menu_order&amp;container_class=navigation');</pre>
<p>As you can see, it accepts the same kind of parameters than the good ol&#8217; <em>wp_list_categories()</em> function.<br /> <strong>Source: <a href="http://wpspecial.net/2010/04/menu-support-for-wordpress-3-0-themes/">http://wpspecial.net/2010/04/menu-support-for-wordpress-3-0-themes/</a></strong></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/8-useful-code-snippets-to-get-started-with-wordpress-3-0">8 useful code snippets to get started with WordPress 3.0</a></p>
<div>
<ul>
<li> <a href="http://del.icio.us/post?url=http://www.catswhocode.com/blog/8-useful-code-snippets-to-get-started-with-wordpress-3-0&amp;title=8+useful+code+snippets+to+get+started+with+WordPress+3.0" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/8-useful-code-snippets-to-get-started-with-wordpress-3-0&amp;title=8+useful+code+snippets+to+get+started+with+WordPress+3.0" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.stumbleupon.com/submit?url=http://www.catswhocode.com/blog/8-useful-code-snippets-to-get-started-with-wordpress-3-0&amp;title=8+useful+code+snippets+to+get+started+with+WordPress+3.0" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/8-useful-code-snippets-to-get-started-with-wordpress-3-0&amp;title=8+useful+code+snippets+to+get+started+with+WordPress+3.0" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/8-useful-code-snippets-to-get-started-with-wordpress-3-0&amp;title=8+useful+code+snippets+to+get+started+with+WordPress+3.0&amp;body=How%20to%20create%20a%20custom%20post%20type%0D%0ACustom%20post%20type%20are%20an%20incredible%20step%20forward%20for%20WordPress%2C%20because%20it%20will%20allow%20developers%20to%20create%20post%20types%20according%20to%20their%20needs.%0D%0AFor%20now%2C%20we%20have%20posts%2C%20and%20pages.%20With%20WordPress%203.0%2C%20we%27ll%20be%20able%20to%20create%20a%20new%20post%20type%20called%20products%2C%20where%20a%20cl" rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://designmoo.com/submit?url=http://www.catswhocode.com/blog/8-useful-code-snippets-to-get-started-with-wordpress-3-0&amp;title=8+useful+code+snippets+to+get+started+with+WordPress+3.0&amp;body=How%20to%20create%20a%20custom%20post%20type%0D%0ACustom%20post%20type%20are%20an%20incredible%20step%20forward%20for%20WordPress%2C%20because%20it%20will%20allow%20developers%20to%20create%20post%20types%20according%20to%20their%20needs.%0D%0AFor%20now%2C%20we%20have%20posts%2C%20and%20pages.%20With%20WordPress%203.0%2C%20we%27ll%20be%20able%20to%20create%20a%20new%20post%20type%20called%20products%2C%20where%20a%20cl" rel="nofollow" title="Moo this on DesignMoo!">Moo this on DesignMoo!</a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/8-useful-code-snippets-to-get-started-with-wordpress-3-0&amp;title=8+useful+code+snippets+to+get+started+with+WordPress+3.0&amp;body=How%20to%20create%20a%20custom%20post%20type%0D%0ACustom%20post%20type%20are%20an%20incredible%20step%20forward%20for%20WordPress%2C%20because%20it%20will%20allow%20developers%20to%20create%20post%20types%20according%20to%20their%20needs.%0D%0AFor%20now%2C%20we%20have%20posts%2C%20and%20pages.%20With%20WordPress%203.0%2C%20we%27ll%20be%20able%20to%20create%20a%20new%20post%20type%20called%20products%2C%20where%20a%20cl" rel="nofollow" title="Blend this!">Blend this!</a></li>
<li> <a href="http://reddit.com/submit?url=http://www.catswhocode.com/blog/8-useful-code-snippets-to-get-started-with-wordpress-3-0&amp;title=8+useful+code+snippets+to+get+started+with+WordPress+3.0" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a></li>
<li> <a href="http://twitter.com/home?status=8+useful+code+snippets+to+get+started+with+WordPress+3.0+-+http://tinyurl.com/y5d5agt+(via+@catswhocode)" rel="nofollow" title="Tweet This!">Tweet This!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/ebdc5_4qWn8jEY8sQ" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/8-useful-code-snippets-to-get-started-with-wordpress-3-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best practices for WordPress coding</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/best-practices-for-wordpress-coding/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/best-practices-for-wordpress-coding/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 04:15:50 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/best-practices-for-wordpress-coding/</guid>
		<description><![CDATA[Think International When coding a WordPress theme or plugin, you have to think about those that doesn&#8217;t speak English. Using the PHP language, two very useful functions are available for you to create a translatable theme or plugin: The first is the function _e(), which prints on screen the desired text, translated into the user [...]]]></description>
			<content:encoded><![CDATA[<h2>Think International</h2>
<p>When coding a WordPress theme or plugin, you have to think about those that doesn&#8217;t speak English. Using the PHP language, two very useful functions are available for you to create a translatable theme or plugin:</p>
<p>The first is the function _e(), which prints on screen the desired text, translated into the user language:</p>
<pre>_e("Text to translate", "textdomain");</pre>
<p>The second is __() wich is basically the same than _e(), but returns the text:</p>
<pre>function say_something() {
    return __("Text to translate", "textdomain");
}</pre>
<p>By using those functions, you make your work translatable in any language, which is a very great thing for people that blog in another language than English.</p>
<h3>Additional resources:</h3>
<ul>
<li><a href="http://codex.wordpress.org/I18n_for_WordPress_Developers">I18n for WordPress Developers</a>: A complete guide about using the Gettext libraries and tools to internationalize your themes and plugins.</li>
<li><a href="http://www.catswhocode.com/blog/how-to-make-a-translatable-wordpress-theme">How to make a translatable WordPress theme</a>: A complete tutorial about creating a translatable WordPress theme.</li>
<li><a href="http://www.code-styling.de/english/development/wordpress-plugin-codestyling-localization-en">WordPress Plugin: Codestyling Localization</a>: A plugin to manage localization files.</li>
</ul>
<h2>Don&#8217;t reinvent the wheel: Use a framework</h2>
<p>While many people thinks that a good developer is someone that can create quality code, they&#8217;re wrong: A good developer is a person who can write quality code, quickly. Being fast is a quality, because clients don&#8217;t want to wait, and time is money.</p>
<p>Being fast doesn&#8217;t mean writing crappy, untested code in order to get things done as soon as possible. Instead, being fast is all about not wasting time. In development, the most important waste of time someone can do is when you&#8217;re reinventing the wheel, i.e. recreating something instead of using the original.</p>
<p>Theme frameworks appeared in 2008. A theme framework is a WordPress theme which can be extended by a child theme. While there are many available frameworks, both free and premium, my favorite is definitely Thematic. You have to learn how Thematic works, which can take some time at first, but once done, you&#8217;ll be surprised by how fast you can create robust and optimized themes.</p>
<p>And for those who think that a framework doesn&#8217;t allow enough modifications to create any type of layout, you&#8217;re wrong: This site and <a href="http://www.catswhoblog.com">CatsWhoBlog</a> are both using Thematic.</p>
<h3>Additional resources:</h3>
<ul>
<li><a href="http://www.catswhocode.com/blog/wordpress-theme-frameworks">WordPress Theme Frameworks explained</a>: This post is interesting for those who don&#8217;t know what&#8217;s a theme framework and why they are time savers.</li>
<li><a href="http://wpshout.com/premium-frameworks-reviewed/">Premium theme frameworks reviewed</a>: A comparison between commercial (ie, non-free) theme frameworks for WordPress.</li>
<li><a href="http://www.catswhocode.com/blog/wordpress-how-to-easily-create-a-thematic-child-theme">How to easily create a Thematic child theme</a>: An easy to follow tutorial for quickly being able to develop killer Thematic child themes.</li>
</ul>
<h2>Speed up development using community tools and templates</h2>
<p>As a WordPress developer, most client requests I got were similar: They wanted a custom theme or plugin. The process of creating files and fill it with the required info (Such as plugin name, url, etc) is very simple but time consuming.</p>
<p>For this reason, you should definitely make use of what the community created for you: Themes and plugins templates, as well as a really interesting plugin called WP Dummy Content, which can automatically generate a bunch of pages, sub-pages, posts, etc for you to test the look and feel of the theme you&#8217;re building.</p>
<h3>Resources</h3>
<ul>
<li><a href="http://wpcandy.com/articles/the-wordpress-starter-theme-project.html">The WordPress Starter Theme Project</a>: A very useful set of files containing a blank style.css with theme name, author, URL, etc. tags at the top, a content-ready 404, archive, search, index, single post, and page files, a full, working comments.php file, a complete header.php set up with links to RSS, a stylesheet, and JS file and all you need to start developing a new WordPress theme.</li>
<li><a href="http://wordpress.org/extend/plugins/wp-dummy-content/">WP Dummy Content</a>: a WordPress plugin that will generate a bunch of pages, sub-pages and posts which you specify. Titles and content are automatically generated for you as well, and you have a few choices as to the type and length of content.</li>
</ul>
<h2>Debug your code efficiently</h2>
<p>As a developer, debugging code is something that you should be used to. Although debugging is rarely a bunch of fun, WordPress has some useful functions that will definitely make your life easier.</p>
<p>The WP_DEBUG constant has to be placed in your wp-config.php file. If defined and set to true, error messages will be displayed.</p>
<pre>define('WP_DEBUG', true);</pre>
<p>If you&#8217;d like to modify WordPress built-in Javascript, you can enable debugging by defining the SCRIPT_DEBUG constant.</p>
<pre>define('SCRIPT_DEBUG', true);</pre>
<h3>Additional resources</h3>
<ul>
<li><a href="http://mc-computing.com/ISPs/WordPress/Debug.html">WordPress debug techniques</a>: An interesting guide for those who don&#8217;t want to spend hours debugging their code.</li>
<li><a href="http://yoast.com/wordpress-debug-theme/">Debug Theme, by Joost</a>: The &#8220;Debug Theme&#8221; is a very special WordPress theme: instead of making your blog looking good, its purpose is to display useful information such as WordPress constants, security key-phrases, etc. A very handy tool when it comes to debugging!</li>
<li><a href="http://wordpress.org/extend/plugins/theme-tester/">Theme Tester plugin</a>: If you need to modify or create a new theme on a production site, this is a must have: This plugin allows you to show the regular theme to your visitors while you&#8217;re working on a new one.</li>
</ul>
<h2>Make use of hooks, actions and filters</h2>
<p>WordPress has very interesting an useful features called actions and filters. While those are intensively used by Theme frameworks and some plugins, most newcomer&#8217;s in WordPress development are ignoring them.</p>
<p>Actions and filters allow you to modify, overwrite or surcharge an existing WordPress function, without having to edit the core files. For that reason, you should always make sure that both the wp_head() and wp_footer() functions have been implemented in the theme you coded:</p>
<pre>&lt;?php wp_head(); ?&amp;gt
    ....
&lt;?php wp_footer(); ?&amp;gt</pre>
<p>Using hooks, you can for example add a favicon to your theme without editing the header.php file. The following example is what I use to add a favicon to a Thematic child theme.</p>
<pre>function add_favicon() { ?&gt;
    &lt;link rel="shortcut icon" href="&lt;?php echo bloginfo('stylesheet_directory') ?&gt;/images/favicon.png"/&gt;
&lt;?php }
add_action('wp_head', 'add_favicon');</pre>
<h3>Additional resources</h3>
<ul>
<li><a href="http://www.raymondselda.com/understanding-action-hooks-in-wordpress/">Understanding action hooks in WordPress</a>: A great tutorial to start with WordPress action hooks.</li>
<li><a href="http://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters">Hooks, actions and filters</a>: The WordPress Codex always has lots of useful information about WordPress development. A great way to get started with this very useful feature!</li>
<li><a href="http://www.smashingmagazine.com/2009/08/18/10-useful-wordpress-hook-hacks/">10 useful WordPress hook hacks</a>: An article I wrote for Smashing Magazine, which features 10 ready to use hooks example.</li>
</ul>
<h2>Code markup like a pro</h2>
<p>A very important aspect of the quality of a WordPress theme is definitely how it is coded. In fact, I know many developers which are very good in PHP and other back-end technologies, but suck at front-end coding.<br /> WordPress is XHTML valid and standard-compliant, so always make sure that your theme or plugin is as well before selling it to your client.</p>
<p>The idea of &#8220;pro front-end coding&#8221; is quite subjective, because not everyone has the same quality standards. However, any WordPress theme or plugin should be:</p>
<ul>
<li><strong>XHTML valid</strong>: Although their usefulness is often discussed, in clients eyes, respect of web standards makes the difference between a poorly skilled amateur and a professional web developer.</li>
<li><strong>Semantically coded</strong>: When html tags are used semantically, this is not only the proper way to create a html document, it will also allow your client to get better search engine optimization results.</li>
<li><strong>No inline styles or Javascript actions</strong>: In-line styles always seem extremely useful at first, but when you have to modify someone else&#8217;s work and it&#8217;s filled with in-line styles, it quickly become a nightmare. Same goes for javascript actions, such as onmouseover and so on. Always put them in a separate file.</li>
</ul>
<p>To learn more about front-end coding best practices, you should definitely have a look to my recent &#8220;<a href="http://www.catswhocode.com/blog/top-10-best-practices-for-front-end-web-developers">Top 10 best practices for front-end web developers</a>&#8221; article.</p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/best-practices-for-wordpress-coding">Best practices for WordPress coding</a></p>
<div>
<ul>
<li> <a href="http://del.icio.us/post?url=http://www.catswhocode.com/blog/best-practices-for-wordpress-coding&amp;title=Best+practices+for+WordPress+coding" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/best-practices-for-wordpress-coding&amp;title=Best+practices+for+WordPress+coding" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.stumbleupon.com/submit?url=http://www.catswhocode.com/blog/best-practices-for-wordpress-coding&amp;title=Best+practices+for+WordPress+coding" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/best-practices-for-wordpress-coding&amp;title=Best+practices+for+WordPress+coding" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/best-practices-for-wordpress-coding&amp;title=Best+practices+for+WordPress+coding&amp;body=Think%20International%0D%0AWhen%20coding%20a%20WordPress%20theme%20or%20plugin%2C%20you%20have%20to%20think%20about%20those%20that%20doesn%27t%20speak%20English.%20Using%20the%20PHP%20language%2C%20two%20very%20useful%20functions%20are%20available%20for%20you%20to%20create%20a%20translatable%20theme%20or%20plugin%3A%0D%0A%0D%0AThe%20first%20is%20the%20function%20_e%28%29%2C%20which%20prints%20on%20screen%20the%20desi" rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://designmoo.com/submit?url=http://www.catswhocode.com/blog/best-practices-for-wordpress-coding&amp;title=Best+practices+for+WordPress+coding&amp;body=Think%20International%0D%0AWhen%20coding%20a%20WordPress%20theme%20or%20plugin%2C%20you%20have%20to%20think%20about%20those%20that%20doesn%27t%20speak%20English.%20Using%20the%20PHP%20language%2C%20two%20very%20useful%20functions%20are%20available%20for%20you%20to%20create%20a%20translatable%20theme%20or%20plugin%3A%0D%0A%0D%0AThe%20first%20is%20the%20function%20_e%28%29%2C%20which%20prints%20on%20screen%20the%20desi" rel="nofollow" title="Moo this on DesignMoo!">Moo this on DesignMoo!</a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/best-practices-for-wordpress-coding&amp;title=Best+practices+for+WordPress+coding&amp;body=Think%20International%0D%0AWhen%20coding%20a%20WordPress%20theme%20or%20plugin%2C%20you%20have%20to%20think%20about%20those%20that%20doesn%27t%20speak%20English.%20Using%20the%20PHP%20language%2C%20two%20very%20useful%20functions%20are%20available%20for%20you%20to%20create%20a%20translatable%20theme%20or%20plugin%3A%0D%0A%0D%0AThe%20first%20is%20the%20function%20_e%28%29%2C%20which%20prints%20on%20screen%20the%20desi" rel="nofollow" title="Blend this!">Blend this!</a></li>
<li> <a href="http://reddit.com/submit?url=http://www.catswhocode.com/blog/best-practices-for-wordpress-coding&amp;title=Best+practices+for+WordPress+coding" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a></li>
<li> <a href="http://twitter.com/home?status=Best+practices+for+WordPress+coding+-+http://tinyurl.com/yef7bv8+(via+@catswhocode)" rel="nofollow" title="Tweet This!">Tweet This!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/d9860_-3v-i8L8UmA" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/best-practices-for-wordpress-coding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10+ regular expressions for efficient web development</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-regular-expressions-for-efficient-web-development/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-regular-expressions-for-efficient-web-development/#comments</comments>
		<pubDate>Sat, 03 Apr 2010 08:06:31 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[9a]]></category>
		<category><![CDATA[buil]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[lower case]]></category>
		<category><![CDATA[maximum length]]></category>
		<category><![CDATA[php code]]></category>
		<category><![CDATA[quickdoc]]></category>
		<category><![CDATA[RegExp]]></category>
		<category><![CDATA[regular expression]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-regular-expressions-for-efficient-web-development/</guid>
		<description><![CDATA[Validate an URL Is a particular url valid? The following regexp will let you know. /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \?=.-]*)*\/?$/ Source: http://snipplr.com/view/19502/validate-a-url/ Validate US phone number This regexp will verify that a US phone number is valid. /^(\+\d)*\s*(\(\d{3}\)\s*)*\d{3}(-{0,1}&#124;\s{0,1})\d{2}(-{0,1}&#124;\s{0,1})\d{2}$/ Source: http://snippets.dzone.com/posts/show/597 Test if a password is strong Weak passwords are one of the quickest ways to get hacked. The [...]]]></description>
			<content:encoded><![CDATA[<h2>Validate an URL</h2>
<p>Is a particular url valid? The following regexp will let you know.</p>
<pre>/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \?=.-]*)*\/?$/</pre>
<p><strong>Source: <a href="http://snipplr.com/view/19502/validate-a-url/">http://snipplr.com/view/19502/validate-a-url/</a></strong></p>
<h2>Validate US phone number</h2>
<p>This regexp will verify that a US phone number is valid.</p>
<pre>/^(\+\d)*\s*(\(\d{3}\)\s*)*\d{3}(-{0,1}|\s{0,1})\d{2}(-{0,1}|\s{0,1})\d{2}$/</pre>
<p><strong>Source: <a href="http://snippets.dzone.com/posts/show/597">http://snippets.dzone.com/posts/show/597</a></strong></p>
<h2>Test if a password is strong</h2>
<p>Weak passwords are one of the quickest ways to get hacked. The following regexp will make sure that:</p>
<ul>
<li>Passwords will contain at least (1) upper case letter</li>
<li>Passwords will contain at least (1) lower case letter</li>
<li>Passwords will contain at least (1) number or special character</li>
<li>Passwords will contain at least (8) characters in length</li>
<li>Password maximum length should not be arbitrarily limited</li>
</ul>
<pre>(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$</pre>
<p><strong>Source: <a href="http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=297">http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=297</a></strong></p>
<h2>Get code within &lt;?php and ?&gt;</h2>
<p>If for some reason you need to grab all the code contained within the &lt;?php and ?&gt; tags, this regexp will do the job:</p>
<pre>&lt;\?[php]*([^\?&gt;]*)\?&gt;</pre>
<p><strong>Source: <a href="http://snipplr.com/view/12845/get-all-the-php-code-between/">http://snipplr.com/view/12845/get-all-the-php-code-between/</a></strong></p>
<h2>Match tel: urls</h2>
<p>In a recent post, I showed you how you can use <a href="http://www.catswhocode.com/blog/10-useful-code-snippets-to-develop-iphone-friendly-websites">iPhone special link prfixes</a> to automatically call someone.<br /> This regular expression will match those <em>tel:</em> urls.</p>
<pre>^tel:((?:\+[\d().-]*\d[\d().-]*|[0-9A-F*#().-]*[0-9A-F*#][0-9A-F*#().-]*(?:;[a-z\d-]+(?:=(?:[a-z\d\[\]\/:&amp;+$_!~*'().-]|%[\dA-F]{2})+)?)*;phone-context=(?:\+[\d().-]*\d[\d().-]*|(?:[a-z0-9]\.|[a-z0-9][a-z0-9-]*[a-z0-9]\.)*(?:[a-z]|[a-z][a-z0-9-]*[a-z0-9])))(?:;[a-z\d-]+(?:=(?:[a-z\d\[\]\/:&amp;+$_!~*'().-]|%[\dA-F]{2})+)?)*(?:,(?:\+[\d().-]*\d[\d().-]*|[0-9A-F*#().-]*[0-9A-F*#][0-9A-F*#().-]*(?:;[a-z\d-]+(?:=(?:[a-z\d\[\]\/:&amp;+$_!~*'().-]|%[\dA-F]{2})+)?)*;phone-context=\+[\d().-]*\d[\d().-]*)(?:;[a-z\d-]+(?:=(?:[a-z\d\[\]\/:&amp;+$_!~*'().-]|%[\dA-F]{2})+)?)*)*)$</pre>
<p><strong>Source: <a href="http://tools.ietf.org/html/rfc3966#section-3">http://tools.ietf.org/html/rfc3966#section-3</a></strong></p>
<h2>Validate US zip code</h2>
<p>When building a registration form, it is common to ask the user&#8217;s zip code. As forms are often boring, there&#8217;s a strong chance that the user will try to register false data. This regular expression will make sure he entered a valid American zip code.</p>
<pre>^[0-9]{5}(-[0-9]{4})?$</pre>
<p><strong>Source: <a href="http://reusablecode.blogspot.com/2008/08/isvalidzipcode.html">http://reusablecode.blogspot.com/2008/08/isvalidzipcode.html</a></strong></p>
<h2>Validate Canadian postal code</h2>
<p>This regexp is very similar to the previous one, but it will match Canadian postal codes instead.</p>
<pre>^[ABCEGHJ-NPRSTVXY]{1}[0-9]{1}[ABCEGHJ-NPRSTV-Z]{1}[ ]?[0-9]{1}[ABCEGHJ-NPRSTV-Z]{1}[0-9]{1}$</pre>
<p><strong>Source: <a href="http://reusablecode.blogspot.com/2008/08/isvalidpostalcode.html">http://reusablecode.blogspot.com/2008/08/isvalidpostalcode.html</a></strong></p>
<h2>Grab unclosed img tags</h2>
<p>As you probably know, the xhtml standard requires all tags to be properly closed. This regular expression will search for unclosed <em>img</em> tags. It could be easily modified to grab any other unclosed html tags.</p>
<pre>&lt;img([^&gt;]+)(\s*[^\/])&gt;</pre>
<p><strong>Source: <a href="http://snipplr.com/view/6632/grab-any-unclosed-xhtml-img-tags/">http://snipplr.com/view/6632/grab-any-unclosed-xhtml-img-tags/</a></strong></p>
<h2>Find all CSS attributes</h2>
<p>This regexp will find CSS attributes, such as <em>background:red;</em> or <em>padding-left:25px;</em>.</p>
<pre>\s(?[a-zA-Z-]+)\s[:]{1}\s*(?[a-zA-Z0-9\s.#]+)[;]{1}</pre>
<p><strong>Source: <a href="http://snipplr.com/view/17903/find-css-attributes/">http://snipplr.com/view/17903/find-css-attributes/</a></strong></p>
<h2>Validate an IBAN</h2>
<p>I have recently worked on a banking application and this one was definitely a life-saver. It will verify that the given IBAN is valid.</p>
<pre>[a-zA-Z]{2}[0-9]{2}[a-zA-Z0-9]{4}[0-9]{7}([a-zA-Z0-9]?){0,16}</pre>
<p><strong>Source: <a href="http://snipplr.com/view/15322/iban-regex-all-ibans/">http://snipplr.com/view/15322/iban-regex-all-ibans/</a></strong></p>
<h2>Validate a BIC code</h2>
<p>Another one very useful for any banking application or website: This regexp will validate a BIC code.</p>
<pre>([a-zA-Z]{4}[a-zA-Z]{2}[a-zA-Z0-9]{2}([a-zA-Z0-9]{3})?)</pre>
<p><strong>Source: <a href="http://snipplr.com/view/15320/bic-bank-identifier-code-regex/">http://snipplr.com/view/15320/bic-bank-identifier-code-regex/</a></strong></p>
<p><strong><em>If you&#8217;re interested in regular expressions, make sure you have read our &#8220;<a href="http://www.catswhocode.com/blog/15-php-regular-expressions-for-web-developers">15 PHP regular expression for developers</a>&#8221; post.</em></strong></p>
<p><em>Like CatsWhoCode? If yes, don&#8217;t hesitate to check my other blog <a href="http://www.catswhoblog.com">CatsWhoBlog</a>: It&#8217;s all about blogging!</em></p>
<p><a href="http://www.catswhocode.com/blog/10-regular-expressions-for-efficient-web-development">10+ regular expressions for efficient web development</a></p>
<div>
<ul>
<li> <a href="http://del.icio.us/post?url=http://www.catswhocode.com/blog/10-regular-expressions-for-efficient-web-development&amp;title=10%2B+regular+expressions+for+efficient+web+development" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/10-regular-expressions-for-efficient-web-development&amp;title=10%2B+regular+expressions+for+efficient+web+development" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.stumbleupon.com/submit?url=http://www.catswhocode.com/blog/10-regular-expressions-for-efficient-web-development&amp;title=10%2B+regular+expressions+for+efficient+web+development" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/10-regular-expressions-for-efficient-web-development&amp;title=10%2B+regular+expressions+for+efficient+web+development" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/10-regular-expressions-for-efficient-web-development&amp;title=10%2B+regular+expressions+for+efficient+web+development&amp;body=Validate%20an%20URL%0D%0AIs%20a%20particular%20url%20valid%3F%20The%20following%20regexp%20will%20let%20you%20know.%0D%0A%2F%5E%28https%3F%3A%5C%2F%5C%2F%29%3F%28%5B%5Cda-z%5C.-%5D%2B%29%5C.%28%5Ba-z%5C.%5D%7B2%2C6%7D%29%28%5B%5C%2F%5Cw%20%5C%3F%3D.-%5D%2A%29%2A%5C%2F%3F%24%2F%0D%0ASource%3A%20http%3A%2F%2Fsnipplr.com%2Fview%2F19502%2Fvalidate-a-url%2F%0D%0AValidate%20US%20phone%20number%0D%0AThis%20regexp%20will%20verify%20that%20a%20US%20phone%20number%20is%20valid.%0D%0A%2F%5E%28%5C%2B%5Cd%29" rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://designmoo.com/submit?url=http://www.catswhocode.com/blog/10-regular-expressions-for-efficient-web-development&amp;title=10%2B+regular+expressions+for+efficient+web+development&amp;body=Validate%20an%20URL%0D%0AIs%20a%20particular%20url%20valid%3F%20The%20following%20regexp%20will%20let%20you%20know.%0D%0A%2F%5E%28https%3F%3A%5C%2F%5C%2F%29%3F%28%5B%5Cda-z%5C.-%5D%2B%29%5C.%28%5Ba-z%5C.%5D%7B2%2C6%7D%29%28%5B%5C%2F%5Cw%20%5C%3F%3D.-%5D%2A%29%2A%5C%2F%3F%24%2F%0D%0ASource%3A%20http%3A%2F%2Fsnipplr.com%2Fview%2F19502%2Fvalidate-a-url%2F%0D%0AValidate%20US%20phone%20number%0D%0AThis%20regexp%20will%20verify%20that%20a%20US%20phone%20number%20is%20valid.%0D%0A%2F%5E%28%5C%2B%5Cd%29" rel="nofollow" title="Moo this on DesignMoo!">Moo this on DesignMoo!</a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/10-regular-expressions-for-efficient-web-development&amp;title=10%2B+regular+expressions+for+efficient+web+development&amp;body=Validate%20an%20URL%0D%0AIs%20a%20particular%20url%20valid%3F%20The%20following%20regexp%20will%20let%20you%20know.%0D%0A%2F%5E%28https%3F%3A%5C%2F%5C%2F%29%3F%28%5B%5Cda-z%5C.-%5D%2B%29%5C.%28%5Ba-z%5C.%5D%7B2%2C6%7D%29%28%5B%5C%2F%5Cw%20%5C%3F%3D.-%5D%2A%29%2A%5C%2F%3F%24%2F%0D%0ASource%3A%20http%3A%2F%2Fsnipplr.com%2Fview%2F19502%2Fvalidate-a-url%2F%0D%0AValidate%20US%20phone%20number%0D%0AThis%20regexp%20will%20verify%20that%20a%20US%20phone%20number%20is%20valid.%0D%0A%2F%5E%28%5C%2B%5Cd%29" rel="nofollow" title="Blend this!">Blend this!</a></li>
<li> <a href="http://reddit.com/submit?url=http://www.catswhocode.com/blog/10-regular-expressions-for-efficient-web-development&amp;title=10%2B+regular+expressions+for+efficient+web+development" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a></li>
<li> <a href="http://twitter.com/home?status=10%2B+regular+expressions+for+efficient+web+development+-+http://tinyurl.com/ybpuprg+(via+@catswhocode)" rel="nofollow" title="Tweet This!">Tweet This!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/60565_URMTKqrC6Sk" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-regular-expressions-for-efficient-web-development/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>10 examples of futuristic CSS3 techniques</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-examples-of-futuristic-css3-techniques/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-examples-of-futuristic-css3-techniques/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 08:15:30 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-examples-of-futuristic-css3-techniques/</guid>
		<description><![CDATA[Pure CSS speech bubbles In a design, bubbles can be great to illustrate a quote. In this article, talented designer Nicolas Gallagher will show you what he built with CSS3: Text bubbles, with no Javascript or images. Source: http://nicolasgallagher.com/demo/pure-css-speech-bubbles/bubbles.html Super Awesome Buttons with CSS3 and RGBA CSS has always been great to enhance buttons; but [...]]]></description>
			<content:encoded><![CDATA[<h2>Pure CSS speech bubbles</h2>
<p>In a design, bubbles can be great to illustrate a quote. In this article, talented designer Nicolas Gallagher will show you what he built with CSS3: Text bubbles, with no Javascript or images.<br /> <img src="http://www.catswhocode.com/blog/wp-content/uploads/2010/03/pure-css-bubbles.jpg" alt="" /><br /> <strong>Source: <a href="http://nicolasgallagher.com/demo/pure-css-speech-bubbles/bubbles.html">http://nicolasgallagher.com/demo/pure-css-speech-bubbles/bubbles.html</a></strong></p>
<h2>Super Awesome Buttons with CSS3 and RGBA</h2>
<p>CSS has always been great to enhance buttons; but using CSS3, the RGBa property, and of course a lot of creativity, you can create modern and clean buttons. The folks at Zurb will show you how in this great tutorial. Note that I enjoyed that technique so much that I used it on my own comment form!<br /> <img src="http://www.catswhocode.com/blog/wp-content/uploads/2010/03/rgba-css3-buttons.png" alt="" /><br /> <strong>Source: <a href="http://www.zurb.com/article/266/super-awesome-buttons-with-css3-and-rgba">http://www.zurb.com/article/266/super-awesome-buttons-with-css3-and-rgba</a></strong></p>
<h2>Classy photo frame using CSS3</h2>
<p>As I recently said on my other blog <a href="http://www.catswhoblog.com">Cats Who Blog</a>, images are very important in blogging, and in the Internet media in general.<br /> In order to enhance your images and give them a unique look and feel, the box-shadow CSS3 property is a must. Here is the code used in the example below:</p>
<p><img src="http://www.catswhocode.com/blog/wp-content/uploads/2010/03/classy-csss3-photo-frame.jpg" alt="" /><br /> <strong>Source: <a href="http://www.change.org/actions/view/tell_the_senate_protect_polar_bears_from_global_warming">http://www.change.org/actions/view/tell_the_senate_protect_polar_bears_from_global_warming</a></strong></p>
<h2>Easily Turn Your Images Into Polaroids with CSS3</h2>
<p>Although this technique can be considered as experimental only (It doesn&#8217;t work on IE, as you can expect&#8230;), I have to admit that I was surprised to see that this demo only uses CSS3 and no Javascript at all.<br /> The tutorial will show you how to use CSS3 to transform a simple image into a Polaroid.<br /> <img src="http://www.catswhocode.com/blog/wp-content/uploads/2010/03/css3-polaroids.png" alt="" /><br /> <strong>Source: <a href="http://www.zurb.com/article/305/easily-turn-your-images-into-polaroids-wi">http://www.zurb.com/article/305/easily-turn-your-images-into-polaroids-wi</a></strong></p>
<h2>Fancy web form with field hints using only CSS3</h2>
<p>Web forms are very important because this is the main way for your visitor to get in touch with you. But styling web forms isn&#8217;t easy, and in most web sites, forms are boring and quite ugly.<br /> The following post will show you how to use CSS3 to create a stylish web form with field hints. And no, it does not require any Javascript.<br /> <img src="http://www.catswhocode.com/blog/wp-content/uploads/2010/03/fancy-web-form-css3.png" alt="" /><br /> <strong>Source: <a href="http://www.skyrocketlabs.com/articles/css3-web-form-hints.php">http://www.skyrocketlabs.com/articles/css3-web-form-hints.php</a></strong></p>
<h2>CSS3 Drop down Menu</h2>
<p>Ah, drop down menus. Those are extremely popular and every designer or developer had to work with at least one in his career. So what about using the power of CSS3 to enhance drop downs? In this article, talented web designer Nick La will show you how to proceed. And I must say that the result is absolutely fantastic.<br /> <img src="http://www.catswhocode.com/blog/wp-content/uploads/2010/03/css3-dropdown-menu.png" alt="" /><br /> <strong>Source: <a href="http://www.webdesignerwall.com/tutorials/css3-dropdown-menu/">http://www.webdesignerwall.com/tutorials/css3-dropdown-menu/</a></strong></p>
<h2>CSS 3 selectors explained</h2>
<p>CSS3 has lots of exiting properties, such as <em>box-shadow</em> and <em>border-radius</em>. But CSS3 also introduces new selectors, which can definitely make your life easier.<br /> Although there&#8217;s nothing hard with these new selectors, it is important to learn what new selectors are available and how they work, so you can use them in your websites. The following tutorial is simple to follow and extremely efficient; a must read for anyone who works with cascading style-sheets!<br /> <img src="http://www.catswhocode.com/blog/wp-content/uploads/2010/03/css3-selectors.png" alt="" /><br /> <strong>Source: <a href="http://www.456bereastreet.com/archive/200601/css_3_selectors_explained/">http://www.456bereastreet.com/archive/200601/css_3_selectors_explained/</a></strong></p>
<h2>Recreate Mac OSX interface using CSS3</h2>
<p>Wow! This one totally rocks. As you can see in the screenshot below, the folks from CSS3.info had fun recreating Mac OSX user interface using CSS3 and some jQuery. Unfortunately, the method they used is not detailed, but you can still view the source and learn by the example.<br /> <img src="http://www.catswhocode.com/blog/wp-content/uploads/2010/03/osx.png" alt="" /><br /> <strong>Source: <a href="http://www.css3.info/wp-content/uploads/2007/08/colormoduletest.html">http://www.css3.info/wp-content/uploads/2007/08/colormoduletest.html</a></strong></p>
<h2>Letterpress Text Effect Using Photoshop and CSS</h2>
<p>Typography is definitely something that can either make a design great, or totally ruin it. CSS3 introduced some really interesting properties to enhance the texts and titles of your designs.<br /> In this post, you&#8217;ll learn how to create a &#8220;Letterpress&#8221; effect using CSS3 and Photoshop.<br /> <img src="http://www.catswhocode.com/blog/wp-content/uploads/2010/03/letterpress.jpg" alt="" /><br /> <strong>Source: <a href="http://acrisdesign.com/2010/03/letterpress-text-effect-using-photoshop-and-css/">http://acrisdesign.com/2010/03/letterpress-text-effect-using-photoshop-and-css/</a></strong></p>
<h2>Creating a Polaroid photo viewer with CSS3 and jQuery</h2>
<p>Seems that Polaroid&#8217;s are popular again: After the Zurb example I shown you earlier, here is another really cool way to create a gallery, using CSS3 and jQuery. The tutorial is easy to follow and the result is quite nice.<br /> <img src="http://www.catswhocode.com/blog/wp-content/uploads/2010/03/polaroid.png" alt="" /><br /> <strong>Source: <a href="http://www.marcofolio.net/webdesign/creating_a_polaroid_photo_viewer_with_css3_and_jquery.html">http://www.marcofolio.net/webdesign/creating_a_polaroid_photo_viewer_with_css3_and_jquery.html</a></strong></p>
<p><strong><em>Any other really cool example of the power of CSS3? Let me know in a comment!</em></strong></p>
<p><em>Have you checked out the highly recommended <a href="http://www.catswhocode.com/blog/diw.html">Digging into WordPress</a> book by Chris Coyier and Jeff Starr?</strong></em></p>
<p><a href="http://www.catswhocode.com/blog/10-examples-of-futuristic-css3-techniques">10 examples of futuristic CSS3 techniques</a></p>
<div>
<ul>
<li> <a href="http://del.icio.us/post?url=http://www.catswhocode.com/blog/10-examples-of-futuristic-css3-techniques&amp;title=10+examples+of+futuristic+CSS3+techniques" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/10-examples-of-futuristic-css3-techniques&amp;title=10+examples+of+futuristic+CSS3+techniques" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.stumbleupon.com/submit?url=http://www.catswhocode.com/blog/10-examples-of-futuristic-css3-techniques&amp;title=10+examples+of+futuristic+CSS3+techniques" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/10-examples-of-futuristic-css3-techniques&amp;title=10+examples+of+futuristic+CSS3+techniques" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/10-examples-of-futuristic-css3-techniques&amp;title=10+examples+of+futuristic+CSS3+techniques&amp;body=Pure%20CSS%20speech%20bubbles%0D%0AIn%20a%20design%2C%20bubbles%20can%20be%20great%20to%20illustrate%20a%20quote.%20In%20this%20article%2C%20talented%20designer%20Nicolas%20Gallagher%20will%20show%20you%20what%20he%20built%20with%20CSS3%3A%20Text%20bubbles%2C%20with%20no%20Javascript%20or%20images.%0D%0A%0D%0ASource%3A%20http%3A%2F%2Fnicolasgallagher.com%2Fdemo%2Fpure-css-speech-bubbles%2Fbubbles.html%0D%0A" rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://designmoo.com/submit?url=http://www.catswhocode.com/blog/10-examples-of-futuristic-css3-techniques&amp;title=10+examples+of+futuristic+CSS3+techniques&amp;body=Pure%20CSS%20speech%20bubbles%0D%0AIn%20a%20design%2C%20bubbles%20can%20be%20great%20to%20illustrate%20a%20quote.%20In%20this%20article%2C%20talented%20designer%20Nicolas%20Gallagher%20will%20show%20you%20what%20he%20built%20with%20CSS3%3A%20Text%20bubbles%2C%20with%20no%20Javascript%20or%20images.%0D%0A%0D%0ASource%3A%20http%3A%2F%2Fnicolasgallagher.com%2Fdemo%2Fpure-css-speech-bubbles%2Fbubbles.html%0D%0A" rel="nofollow" title="Moo this on DesignMoo!">Moo this on DesignMoo!</a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/10-examples-of-futuristic-css3-techniques&amp;title=10+examples+of+futuristic+CSS3+techniques&amp;body=Pure%20CSS%20speech%20bubbles%0D%0AIn%20a%20design%2C%20bubbles%20can%20be%20great%20to%20illustrate%20a%20quote.%20In%20this%20article%2C%20talented%20designer%20Nicolas%20Gallagher%20will%20show%20you%20what%20he%20built%20with%20CSS3%3A%20Text%20bubbles%2C%20with%20no%20Javascript%20or%20images.%0D%0A%0D%0ASource%3A%20http%3A%2F%2Fnicolasgallagher.com%2Fdemo%2Fpure-css-speech-bubbles%2Fbubbles.html%0D%0A" rel="nofollow" title="Blend this!">Blend this!</a></li>
<li> <a href="http://reddit.com/submit?url=http://www.catswhocode.com/blog/10-examples-of-futuristic-css3-techniques&amp;title=10+examples+of+futuristic+CSS3+techniques" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a></li>
<li> <a href="http://twitter.com/home?status=10+examples+of+futuristic+CSS3+techniques+-+http://tinyurl.com/ye9du62+(via+@catswhocode)" rel="nofollow" title="Tweet This!">Tweet This!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://feeds.feedburner.com/~r/Catswhocode/~4/M-4tbVvlfdQ" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-examples-of-futuristic-css3-techniques/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Top 10 best practices for front-end web developers</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/top-10-best-practices-for-front-end-web-developers/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/top-10-best-practices-for-front-end-web-developers/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 16:30:27 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[code organization]]></category>
		<category><![CDATA[desert island]]></category>
		<category><![CDATA[div id]]></category>
		<category><![CDATA[div tag]]></category>
		<category><![CDATA[h2 h3]]></category>
		<category><![CDATA[html elements]]></category>
		<category><![CDATA[quality code]]></category>
		<category><![CDATA[table caption]]></category>
		<category><![CDATA[transparent body]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/top-10-best-practices-for-front-end-web-developers/</guid>
		<description><![CDATA[Explain which div you&#8217;re closing Most of the time when I&#8217;m viewing a website source, I see, at the very bottom of the page, an almost endless list of closing &#60;/div&#62; tags. In fact, many beginners think they just have to use divs instead of tables to produce quality code. Divs are cleaners than tables, [...]]]></description>
			<content:encoded><![CDATA[<h2>Explain which div you&#8217;re closing</h2>
<p>Most of the time when I&#8217;m viewing a website source, I see, at the very bottom of the page, an almost endless list of closing <em>&lt;/div&gt;</em> tags. In fact, many beginners think they just have to use divs instead of tables to produce quality code. Divs are cleaners than tables, but without proper code organization, it can be as (or even sometimes more) messy as table based code.</p>
<p>Using indentation is a good start. But a tip that can definitely make you save lot of time is to comment every div tag you&#8217;re closing, as shown in the example below:</p>
<pre>&lt;div id="header"&gt;
  &lt;div id="sub" class="first left"&gt;
    ...
  &lt;/div&gt;&lt;!-- #sub.first.left --&gt;
&lt;/div&gt;&lt;!-- #header --&gt;</pre>
<h2>Use a CSS reset</h2>
<p>Unless you&#8217;re a beginner or if you were on vacation on a desert island for the last 6 years, you might already know how useful a CSS reset it. Because by default, browsers don&#8217;t apply the same default styling to HTML elements, a CSS reset will ensure that all element have no particular style so you can define your own without the risk of many cross-browser rendering issues.</p>
<pre>html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
	margin: 0;
	padding: 0;
	border: 0;
	outline: 0;
	font-size: 100%;
	vertical-align: baseline;
	background: transparent;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}

/* remember to define focus styles! */
:focus {
	outline: 0;
}

/* remember to highlight inserts somehow! */
ins {
	text-decoration: none;
}
del {
	text-decoration: line-through;
}

/* tables still need 'cellspacing="0"' in the markup */
table {
	border-collapse: collapse;
	border-spacing: 0;
}</pre>
<p><strong>Source: <a href="http://meyerweb.com/eric/tools/css/reset/index.html">http://meyerweb.com/eric/tools/css/reset/index.html</a></strong></p>
<h2>Don&#8217;t use @import</h2>
<p>CSS files can be included using the @import directive. This can be useful when, for example, you want to include a stylesheet into another. Another common practice is to include CSS file in html documents using the following:</p>
<pre>&lt;style type="text/css&gt;
  @import url('a.css');
  @import url('b.css');
&lt;/style&gt;</pre>
<p>While it works, the <em>@import</em> directive is much slower than the other way to include stylesheets into a html document:</p>
<pre>&lt;link rel='stylesheet' type='text/css' href='a.css'&gt;
&lt;link rel='stylesheet' type='text/css' href='proxy.css'&gt;</pre>
<p>It will not make a difference on low traffic websites, but if you have the chance to own a popular website, don&#8217;t waste your visitor&#8217;s time using <em>@import</em>.<br /> <strong>Source: <a href="http://www.stevesouders.com/blog/2009/04/09/dont-use-import/">http://www.stevesouders.com/blog/2009/04/09/dont-use-import/</a></strong></p>
<h2>&#8220;Smush&#8221; your images</h2>
<p>Being a developer, I always found that optimizing my images for the web wasn&#8217;t easy. I tried the good old &#8220;Save for web&#8221; Photoshop command, but most of the time, I ended up with images that were either too big or without a sufficient quality.<br /> As a result, I had the bad habit of using unoptimized images on my websites. This isn&#8217;t a problem when you don&#8217;t have to care about your site&#8217;s bandwidth, but after my recent switch on my <a href="http://couponsforbloggers.com/go/vpsnet">vps.net</a> virtual private server, I had to be careful with image sizes.</p>
<p>At this time, I found a very cool tool named <a href="http://www.smush.it">Smush It</a>: You enter your unoptimized image url, and Smush It will create a perfectly optimized image for you. You can save up to 70% of the file size, while keeping the original quality. As an example, all the images from my <a href="http://www.catswhocode.com/blog/10-useful-online-code-editors">list of online code editors</a> have been &#8220;smushed&#8221;.</p>
<h2>Don&#8217;t mix CSS with HTML</h2>
<p>As a markup language, the right use of HTML is to organize documents by defining a header, a footer, lists, blockquotes, etc. Some time ago, front-end web developers often used now deprecated HTML attributes to style a particular element.<br /> Nowadays, the <em>style</em> attribute allows developers to insert CSS directly into a html document. This is very useful for testing or when you&#8217;re in a hurry. But the <em>style</em> attribute is bad practice, that goes completely against the CSS philosophy.</p>
<p>The following example illustrates how dirty and hard to read a simple line of code can become, with the <em>style</em> attribute:</p>
<pre>&lt;a href="http://www.catswhocode.com" style="background:#069;padding:3px;font-weight:bold;color:#fff;"&gt;Cats Who Code&lt;/a&gt;</pre>
<h2>Don&#8217;t mix Javascript with HTML</h2>
<p>Just like mixing your html code with css is bad practice, you shouldn&#8217;t use any Javascript in your html documents. The following bad practice illustrates an <em>onclick</em> event:</p>
<pre>&lt;a id="cwc" href="http://www.catswhocode.com" onclick="alert('I love this site!');"&gt;Cats Who Code&lt;/a&gt;</pre>
<p>The same result can be achieved using unobstructed Javascript. In this example, I&#8217;m using the popular jQuery framework:</p>
<pre>$(document).ready(function() {
  $('#cwc').click(function() {
    alert('I love this website');
  });
});</pre>
<p>This may seems a bit harder at first, especially for beginners; but it is definitely not, and it will keep your html document clean.</p>
<h2>Use conditional comments</h2>
<p>You know it, IE sucks, and some clients suck even more by requiring you to create webpages which are compatible with this obsolete browser. To target specific versions of IE, you can use the well known IE hacks, as shown below:</p>
<pre>height: 200px; /* normal browsers */
_height: 300px; /* IE6 */
.height: 250px; /* IE7 */
*height: 350px; /* All IEs */</pre>
<p>Those hacks are extremely useful sometimes, but they are not the best way to target a specific version of IE, and it will cause your CSS validation to fail.</p>
<p>Instead, you should use the conditional comment shown below to target IE6.</p>
<pre>&lt;link href="style.css" rel="stylesheet" type="text/css" /&gt;

&lt;!--[if lte IE 6]&gt;
  &lt;link href="ie.css" rel="stylesheet" type="text/css" /&gt;
&lt;![endif]--&gt;</pre>
<h2>Place Javascript file at the bottom</h2>
<p>A popular practice of the late 90&#8217;s/early 2000&#8217;s was to place Javascript files within the <em>&lt;head&gt;</em> and <em>&lt;/head&gt;</em> tags. The problem is that your javascript files will be loaded first, and consequently your content will be loaded after.</p>
<p>By placing Javascript files at the bottom of your documents, you&#8217;ll ensure that JS files will be loaded only when the content has been properly displayed.</p>
<pre>    ...
    &lt;script type='text/javascript' src='jquery.js?ver=1.3.2'&gt;&lt;/script&gt;
  &lt;/body&gt;
&lt;/html&gt;</pre>
<p><strong><a></a></strong></p>
<h2>Use HTML semantically</h2>
<p>HTML is not a programming language. It is a markup language, used to create structured documents by denoting structural semantics for text such as headings, paragraphs, lists, and more.<br /> If you started to create websites in the good old 90&#8217;s or in the beginning of the century, you know how dirty the markup was at the time. But happilly, it has evolved.<br /> Among other things, it is important to use html element semantically. As an example, a navigation menu should always be an unordered list:</p>
<pre>&lt;ul&gt;
  &lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;About&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Contact&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Blog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<h2>Test WHILE you build to avoid cross-browser issues</h2>
<p>One of the biggest mistake I ever made when developing html, CSS, and javascript, was not to test my pages on multiple browser while I was writing them. Instead, I used to write all my code and just view in Firefox to see how it was rendered.<br /> In theory, this should be good. But as you know, cross-browser issues are a major problem for front-end developers, especially due to IE. If you test your documents on Firefox/IE/Chrome while your writing it, cross-browser rendering problems will be much easier to fix. I have lost hours not doing it, so I hope this final tip will help you saving your precious time. To test on multiple versions of IE, I use <a href="http://spoon.net/browsers/">this very handy tool</a>. Happy coding <img src="http://www.catswhocode.com/blog/wp-includes/images/smilies/icon_wink.gif" alt=";)" class="wp-smiley" /></p>
<p><em>Have you checked out the highly recommended <a href="http://www.catswhocode.com/blog/diw.html">Digging into WordPress</a> book by Chris Coyier and Jeff Starr?</strong></em></p>
<p><a href="http://www.catswhocode.com/blog/top-10-best-practices-for-front-end-web-developers">Top 10 best practices for front-end web developers</a></p>
<div>
<ul>
<li> <a href="http://del.icio.us/post?url=http://www.catswhocode.com/blog/top-10-best-practices-for-front-end-web-developers&amp;title=Top+10+best+practices+for+front-end+web+developers" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/top-10-best-practices-for-front-end-web-developers&amp;title=Top+10+best+practices+for+front-end+web+developers" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.stumbleupon.com/submit?url=http://www.catswhocode.com/blog/top-10-best-practices-for-front-end-web-developers&amp;title=Top+10+best+practices+for+front-end+web+developers" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/top-10-best-practices-for-front-end-web-developers&amp;title=Top+10+best+practices+for+front-end+web+developers" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/top-10-best-practices-for-front-end-web-developers&amp;title=Top+10+best+practices+for+front-end+web+developers&amp;body=Explain%20which%20div%20you%27re%20closing%0D%0AMost%20of%20the%20time%20when%20I%27m%20viewing%20a%20website%20source%2C%20I%20see%2C%20at%20the%20very%20bottom%20of%20the%20page%2C%20an%20almost%20endless%20list%20of%20closing%20%26lt%3B%2Fdiv%26gt%3B%20tags.%20In%20fact%2C%20many%20beginners%20think%20they%20just%20have%20to%20use%20divs%20instead%20of%20tables%20to%20produce%20quality%20code.%20Divs%20are%20cleaners%20than" rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://designmoo.com/submit?url=http://www.catswhocode.com/blog/top-10-best-practices-for-front-end-web-developers&amp;title=Top+10+best+practices+for+front-end+web+developers&amp;body=Explain%20which%20div%20you%27re%20closing%0D%0AMost%20of%20the%20time%20when%20I%27m%20viewing%20a%20website%20source%2C%20I%20see%2C%20at%20the%20very%20bottom%20of%20the%20page%2C%20an%20almost%20endless%20list%20of%20closing%20%26lt%3B%2Fdiv%26gt%3B%20tags.%20In%20fact%2C%20many%20beginners%20think%20they%20just%20have%20to%20use%20divs%20instead%20of%20tables%20to%20produce%20quality%20code.%20Divs%20are%20cleaners%20than" rel="nofollow" title="Moo this on DesignMoo!">Moo this on DesignMoo!</a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/top-10-best-practices-for-front-end-web-developers&amp;title=Top+10+best+practices+for+front-end+web+developers&amp;body=Explain%20which%20div%20you%27re%20closing%0D%0AMost%20of%20the%20time%20when%20I%27m%20viewing%20a%20website%20source%2C%20I%20see%2C%20at%20the%20very%20bottom%20of%20the%20page%2C%20an%20almost%20endless%20list%20of%20closing%20%26lt%3B%2Fdiv%26gt%3B%20tags.%20In%20fact%2C%20many%20beginners%20think%20they%20just%20have%20to%20use%20divs%20instead%20of%20tables%20to%20produce%20quality%20code.%20Divs%20are%20cleaners%20than" rel="nofollow" title="Blend this!">Blend this!</a></li>
<li> <a href="http://reddit.com/submit?url=http://www.catswhocode.com/blog/top-10-best-practices-for-front-end-web-developers&amp;title=Top+10+best+practices+for+front-end+web+developers" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a></li>
<li> <a href="http://twitter.com/home?status=Top+10+best+practices+for+front-end+web+developers+-+http://tinyurl.com/yhd2dmf+(via+@catswhocode)" rel="nofollow" title="Tweet This!">Tweet This!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://feeds.feedburner.com/~r/Catswhocode/~4/iuZsI6IxZPY" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/top-10-best-practices-for-front-end-web-developers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>10 sql tips to speed up your database</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-sql-tips-to-speed-up-your-database/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-sql-tips-to-speed-up-your-database/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 18:15:15 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-sql-tips-to-speed-up-your-database/</guid>
		<description><![CDATA[Design your database with caution This first tip may seems obvious, but the fact is that most database problems come from badly-designed table structure. For example, I have seen people storing information such as client info and payment info in the same database column. For both the database system and developers who will have to [...]]]></description>
			<content:encoded><![CDATA[<h2>Design your database with caution</h2>
<p>This first tip may seems obvious, but the fact is that most database problems come from badly-designed table structure.<br /> For example, I have seen people storing information such as client info and payment info in the same database column. For both the database system and developers who will have to work on it, this is not a good thing.<br /> When creating a database, always put information on various tables, use clear naming standards and make use of primary keys.<br /> <strong>Source: <a href="http://www.simple-talk.com/sql/database-administration/ten-common-database-design-mistakes/">http://www.simple-talk.com/sql/database-administration/ten-common-database-design-mistakes/</a></strong></p>
<h2>Know what you should optimize</h2>
<p>If you want to optimize a specific query, it is extremely useful to be able to get an in-depth look at the result of a query. Using the <em>EXPLAIN</em> statement, you will get lots of useful info on the result produced by a specific query, as shown in the example below:</p>
<pre>EXPLAIN SELECT * FROM ref_table,other_table WHERE ref_table.key_column=other_table.column;</pre>
<p><strong>Source: <a href="http://dev.mysql.com/doc/refman/5.0/en/using-explain.html">http://dev.mysql.com/doc/refman/5.0/en/using-explain.html</a></strong></p>
<h2>The fastest query&#8230; Is the one you don&#8217;t send</h2>
<p>Each time you&#8217;re sending a query to the database, you&#8217;re using a bit of your server resources. This is why, on high traffic sites, the best thing you can do in order to speed up your database is to cache queries.</p>
<p>There&#8217;s lots of solutions to implement a query cache on your server. Here are a few:</p>
<ul>
<li><a href="http://adodb.sourceforge.net/">AdoDB</a>: AdoDB is a database abstraction library for PHP. It allows you to use the database system of your choice (MySQL, PostGreSQL, Interbase, and way much more) and it is designed for speed. AdoDB provides a simple, yet powerful caching system. And last but not least, AdoDB is licenced under the BSD, which means that you can use freely on your projects. A LGPL licence is also available for commercial projects.</li>
<li><a href="http://www.memcached.org/">Memcached</a>: Memcached is a distributed memory caching system which is often used to speed up dynamic database-driven websites by alleviating database load.</li>
<li><a href="http://www.csqlcache.com/">CSQL Cache</a>: CSQL Cache is an open-source data caching infrastructure. Never tested it personally, but it seems to be a great tool.</li>
</ul>
<h2>Don&#8217;t select what you don&#8217;t need</h2>
<p>A very common way to get the desired data is to use the * symbol, which will get all fields from the desired table:</p>
<pre>SELECT * FROM wp_posts;</pre>
<p>Instead, you should definitely select only the desired fields as shown in the example below. On a very small site with, let&#8217;s say, one visitor per minute, that wouldn&#8217;t make a difference. But on a site such as Cats Who Code, it saves a lot of work for the database.</p>
<pre>SELECT title, excerpt, author FROM wp_posts;</pre>
<h2>Use LIMIT</h2>
<p>It&#8217;s very common that you need to get only a specific number of records from your database. For example, a blog which is showing ten entries per page. In that case, you should definitely use the LIMIT parameter, which only selects the desired number of records.<br /> Without LIMIT, if your table has 100,000 different records, you&#8217;ll extract them all, which is unnecessary work for your server.</p>
<pre>SELECT title, excerpt, author FROM wp_posts LIMIT 10;</pre>
<h2>Avoid queries in loops</h2>
<p>When using SQL along with a programming language such as PHP, it can be tempting to use SQL queries inside a loop. But doing so is like hammering your database with queries.<br /> This example illustrates the whole &#8220;queries in loops&#8221; problem:</p>
<pre>foreach ($display_order as $id =&gt; $ordinal) {
    $sql = "UPDATE categories SET display_order = $ordinal WHERE id = $id";
    mysql_query($sql);
}</pre>
<p>Here is what you should do instead:</p>
<pre>UPDATE categories
    SET display_order = CASE id
        WHEN 1 THEN 3
        WHEN 2 THEN 4
        WHEN 3 THEN 5
    END
WHERE id IN (1,2,3)</pre>
<p><strong>Source: <a href="http://www.karlrixon.co.uk/articles/sql/update-multiple-rows-with-different-values-and-a-single-sql-query/">http://www.karlrixon.co.uk/articles/sql/update-multiple-rows-with-different-values-and-a-single-sql-query/</a></strong></p>
<h2>Use join instead of subqueries</h2>
<p>As a programmer, subqueries are something that you can be tempted to use and abuse. Subqueries, as show below, can be very useful:</p>
<pre>SELECT a.id,
    (SELECT MAX(created)
    FROM posts
    WHERE author_id = a.id)
AS latest_post FROM authors a</pre>
<p>Although subqueries are useful,  they often can be replaced by a join, which is definitely faster to execute.</p>
<pre>SELECT a.id, MAX(p.created) AS latest_post
FROM authors a
INNER JOIN posts p
    ON (a.id = p.author_id)
GROUP BY a.id</pre>
<p><strong>Source: <a href="http://20bits.com/articles/10-tips-for-optimizing-mysql-queries-that-dont-suck/">http://20bits.com/articles/10-tips-for-optimizing-mysql-queries-that-dont-suck/</a></strong></p>
<h2>Be careful when using wildcards</h2>
<p>Wildcards are very useful because they can substitute for one or more characters when searching for data in a database. I&#8217;m not saying that you shouldn&#8217;t use them, but instead, you should use them with caution and not use the full wildcard when the prefix or postfix wildcard can do the same job.<br /> In fact, doing a full wildcard search on a million records will certainly kill your database.</p>
<pre>#Full wildcard
SELECT * FROM TABLE WHERE COLUMN LIKE '%hello%';
#Postfix wildcard
SELECT * FROM TABLE WHERE COLUMN LIKE  'hello%';
#Prefix wildcard
SELECT * FROM TABLE WHERE COLUMN LIKE  '%hello';</pre>
<p><strong>Source: <a href="http://hungred.com/useful-information/ways-optimize-sql-queries/">http://hungred.com/useful-information/ways-optimize-sql-queries/</a></strong></p>
<h2>Use UNION instead of OR</h2>
<p>The following example use the <em>OR</em> statement to get the result:</p>
<pre>SELECT * FROM a, b WHERE a.p = b.q or a.x = b.y;</pre>
<p>The <em>UNION</em> statement allows you to combine the result sets of 2 or more select queries. The following example will return the same result that the above query gets, but it will be faster:</p>
<pre>SELECT * FROM a, b WHERE a.p = b.q
UNION
SELECT * FROM a, b WHERE a.x = b.y</pre>
<p><strong>Source: <a href="http://www.bcarter.com/optimsql.htm">http://www.bcarter.com/optimsql.htm</a></strong></p>
<h2>Use indexes</h2>
<p>Database indexes are similar to those you can find in libraries: They allow the database to find the requested information faster, just like a library index will allow a reader to find what they&#8217;re looking for without loosing time.<br /> An Index can be created on a single column or a combination of columns in a database table. A table index is a database structure that arranges the values of one or more columns in a database table in specific order.</p>
<p>The following query will create an index on the <em>Model</em> column from the <em>Product</em> table. The index is called <em>idxModel</em>:</p>
<pre>CREATE INDEX idxModel ON Product (Model);</pre>
<p><strong>Source: <a href="http://www.sql-tutorial.com/sql-indexes-sql-tutorial/">http://www.sql-tutorial.com/sql-indexes-sql-tutorial/</a></strong></p>
<p><em>Have you checked out the highly recommended <a href="http://www.catswhocode.com/blog/diw.html">Digging into WordPress</a> book by Chris Coyier and Jeff Starr?</strong></em></p>
<p><a href="http://www.catswhocode.com/blog/10-sql-tips-to-speed-up-your-database">10 sql tips to speed up your database</a></p>
<div>
<ul>
<li> <a href="http://del.icio.us/post?url=http://www.catswhocode.com/blog/10-sql-tips-to-speed-up-your-database&amp;title=10+sql+tips+to+speed+up+your+database" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/10-sql-tips-to-speed-up-your-database&amp;title=10+sql+tips+to+speed+up+your+database" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.stumbleupon.com/submit?url=http://www.catswhocode.com/blog/10-sql-tips-to-speed-up-your-database&amp;title=10+sql+tips+to+speed+up+your+database" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/10-sql-tips-to-speed-up-your-database&amp;title=10+sql+tips+to+speed+up+your+database" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/10-sql-tips-to-speed-up-your-database&amp;title=10+sql+tips+to+speed+up+your+database&amp;body=Design%20your%20database%20with%20caution%0D%0AThis%20first%20tip%20may%20seems%20obvious%2C%20but%20the%20fact%20is%20that%20most%20database%20problems%20come%20from%20badly-designed%20table%20structure.%0D%0AFor%20example%2C%20I%20have%20seen%20people%20storing%20information%20such%20as%20client%20info%20and%20payment%20info%20in%20the%20same%20database%20column.%20For%20both%20the%20database%20syst" rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://designmoo.com/submit?url=http://www.catswhocode.com/blog/10-sql-tips-to-speed-up-your-database&amp;title=10+sql+tips+to+speed+up+your+database&amp;body=Design%20your%20database%20with%20caution%0D%0AThis%20first%20tip%20may%20seems%20obvious%2C%20but%20the%20fact%20is%20that%20most%20database%20problems%20come%20from%20badly-designed%20table%20structure.%0D%0AFor%20example%2C%20I%20have%20seen%20people%20storing%20information%20such%20as%20client%20info%20and%20payment%20info%20in%20the%20same%20database%20column.%20For%20both%20the%20database%20syst" rel="nofollow" title="Moo this on DesignMoo!">Moo this on DesignMoo!</a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/10-sql-tips-to-speed-up-your-database&amp;title=10+sql+tips+to+speed+up+your+database&amp;body=Design%20your%20database%20with%20caution%0D%0AThis%20first%20tip%20may%20seems%20obvious%2C%20but%20the%20fact%20is%20that%20most%20database%20problems%20come%20from%20badly-designed%20table%20structure.%0D%0AFor%20example%2C%20I%20have%20seen%20people%20storing%20information%20such%20as%20client%20info%20and%20payment%20info%20in%20the%20same%20database%20column.%20For%20both%20the%20database%20syst" rel="nofollow" title="Blend this!">Blend this!</a></li>
<li> <a href="http://reddit.com/submit?url=http://www.catswhocode.com/blog/10-sql-tips-to-speed-up-your-database&amp;title=10+sql+tips+to+speed+up+your+database" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a></li>
<li> <a href="http://twitter.com/home?status=10+sql+tips+to+speed+up+your+database+-+http://tinyurl.com/ydwry9g+(via+@catswhocode)" rel="nofollow" title="Tweet This!">Tweet This!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/978c6_tHr1Y7l5y04" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-sql-tips-to-speed-up-your-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with CouchDB: a beginner’s guide</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/getting-started-with-couchdb-a-beginner%e2%80%99s-guide/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/getting-started-with-couchdb-a-beginner%e2%80%99s-guide/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 17:30:02 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/getting-started-with-couchdb-a-beginner%e2%80%99s-guide/</guid>
		<description><![CDATA[Getting started with CouchDB Apache CouchDB is one of a new breed of database management systems. These new systems are known as NoSQL. NoSQL is a buzz word term first popularized in early 2009 to describe a database that is non-SQL&#8230; NoSQL is a term for a loosely defined class of non-relational data stores that [...]]]></description>
			<content:encoded><![CDATA[<h2>Getting started with CouchDB</h2>
<p>Apache CouchDB is one of a new breed of database management systems. These new systems are known as NoSQL. NoSQL is a buzz word term first popularized in early 2009 to describe a database that is non-SQL&#8230; NoSQL is a term for a loosely defined class of non-relational data stores that break with a long history of relational databases and ACID guarantees. Data stores that fall under this term may not require fixed table schemas.</p>
<p>The first reason I am quickly growing to love CouchDB, and hence decided to write this post is due to the fact that it is a document-oriented DB, rather then storing content into set tables, it allows us to store information, in a manor that is as flexible as an array.</p>
<p>For example here&#8217;s a sample document:</p>
<pre>
FirstName="Bob", Address="5 Oak St.", Hobby="sailing".
</pre>
<p>However another document could have this data:</p>
<pre>
FirstName="Jonathan", Address="15 Wanamassa Point Road", Children=("Michael,10", "Jennifer,8", "Samantha,5", "Elena,2").
</pre>
<p>This is great because first of all, we are not wasting storage on empty, or null fields.</p>
<p>The second reason this is nice, is that we no longer worry about tables, and columns! we need to set info, then we set just what we need. This CAN cause issues if you do not plan correctly, but we will get into that a little later on.</p>
<p>Another big reason I like CouchDB, is that access is through a REST API, for those who know what that means, this is big! For those who don&#8217;t, it means access to get or set data can be granted directly from the browser via javascript, without the need to write extra PHP code on the server side!</p>
<h2>Using CouchDB</h2>
<p>Now that I have you all hyped about it, lets get to using it. The first thing you need to know is that PHP does not have any built in functions to access a CouchDB database.<br /> To do this I recommend <a href="http://arbitracker.org/phpillow.html">PHPillow</a>, a class written by Kore Nordmann. It is definitely one of the best I have seen so far. The second thing you need to know is that setting, and querying a CouchDB is not the same as a MySQL query. As I stated, PHPillow is the best (in my opinion) way to access CouchDB, so that is what I will be using in this example&#8230;</p>
<p><strong>Database connection</strong><br /> To connect to your CouchDB instance simply use the <em>phpillowConnection</em> class like shown here:</p>
<pre>
phpillowConnection-&gt;createInstance('localhost', 5984, 'user', 'password');
</pre>
<p>Once created this connection will be used in your document and view classes automatically.</p>
<p><strong>Define a custom document</strong><br /> All documents extend the abstract base class phpillowDocument. A complete model defining a blog entry could look like:</p>
<pre>
class myBlogDocument extends phpillowDocument
{
    protected static $type = 'blog_entry';

    protected $requiredProperties = array(
        'title',
        'text',
    );

    public function __construct()
    {
        $this-&gt;properties = array(
            'title'     =&gt; new phpillowStringValidator(),
            'text'      =&gt; new phpillowTextValidator(),
            'comments'  =&gt; new phpillowDocumentArrayValidator(
                'myBlogComments'
            ),
        );

        parent::__construct();
    }

    protected function generateId()
    {
        return $this-&gt;stringToId( $this-&gt;storage-&gt;title );
    }

    protected function getType()
    {
        return self::$type;
    }
}
</pre>
<p>The static property <em>$type</em> defines the type of the stored document and should be unique for each document in your application. If you are implementing a module, prefix this type with the name of the module, like &#8220;blog&#8221; in this example. If you happen to use a PHP version prior 5.3 you have to return the document type in each of your document classes like shown above. 5.3 and above users can use a more generic approach with returning <em>static::$type</em> in a base document class.</p>
<p>The <em>$requiredProperties</em> array defined the properties, which are mandatory to be set. The properties itself are defined in the $properties property, which is initialized in the constructor of the document. We associate a validator with each property which validates the input set on the document. There are quite complex validators, like the <em>phpillowDocumentArrayValidator</em> shown here, which will be described later, which are all documented in the generated API documentation.</p>
<p>The last thing you need to define is the generation of the document ID. An ID in CouchDB needs to fulfill some requirements, which are ensured by using the protected method <em>stringToId()</em>. Normally you use one somehow unique property of the document. If this is not entirely unique the document handler will append something, so that it will get unique. Just return null if you want CouchDB to give you an unique id for the document.</p>
<p><strong>Using a document</strong><br /> Now to save data using the document layout that the above code would create we can simply call:</p>
<pre>
$doc = new myBlogDocument();
$doc-&gt;title = 'New blog post';
$doc-&gt;text  = 'Hello world.';
$doc-&gt;save();
</pre>
<p>With the call to the <em>save()</em> method the document will be generated and stored in the database. After this a new magic property is available for the document:</p>
<pre>
$doc-&gt;_id;
</pre>
<p>Using documents directly this ID is the way to fetch the document back from the database, like:</p>
<pre>
$doc = new myBlogDocument();
$doc-&gt;fetchById('blog_entry-new_blog_post');
</pre>
<p>This call retrieved the above document back from the database. The magic CouchDB properties <em>_id</em> and <em>_rev</em> (for revision) are set for the document. Beside the defined properties another property has been created by the wrapper, called revisions, which contains all old (and the current) revisions of the document:</p>
<pre>
echo $doc-&gt;revisions[0]['title'];
</pre>
<p>If you now change a property on the object and store it again in the database the old revision will also be stored in the database, so that no information is lost on change. This behavior may be deactivated by setting the <em>$versioned</em> property to false.</p>
<p><strong>Did you say revisions? </strong><br /> Why yes I did! Thanks for noticing! My Steve Jobs &#8220;One more thing!&#8221; moment, is that if you alter a document in a CouchDB database, it save the pervious version as a revision automagicly! <strong>No need for multiple database entries to make sure your application can roll back</strong>!</p>
<p>So thats about it for this tutorial. Next time we will get into how to run more advanced queries using PHPillow.</p>
<p><em>Have you checked out the highly recommended <a href="http://www.catswhocode.com/blog/diw.html">Digging into WordPress</a> book by Chris Coyier and Jeff Starr?</strong></em></p>
<p><a href="http://www.catswhocode.com/blog/getting-started-with-couchdb-tutorial-a-beginners-guide">Getting started with CouchDB: a beginner&#8217;s guide</a></p>
<div>
<ul>
<li> <a href="http://del.icio.us/post?url=http://www.catswhocode.com/blog/getting-started-with-couchdb-tutorial-a-beginners-guide&amp;title=Getting+started+with+CouchDB%3A+a+beginner%27s+guide" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/getting-started-with-couchdb-tutorial-a-beginners-guide&amp;title=Getting+started+with+CouchDB%3A+a+beginner%27s+guide" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.stumbleupon.com/submit?url=http://www.catswhocode.com/blog/getting-started-with-couchdb-tutorial-a-beginners-guide&amp;title=Getting+started+with+CouchDB%3A+a+beginner%27s+guide" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/getting-started-with-couchdb-tutorial-a-beginners-guide&amp;title=Getting+started+with+CouchDB%3A+a+beginner%27s+guide" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/getting-started-with-couchdb-tutorial-a-beginners-guide&amp;title=Getting+started+with+CouchDB%3A+a+beginner%27s+guide&amp;body=Getting%20started%20with%20CouchDB%0D%0AApache%20CouchDB%20is%20one%20of%20a%20new%20breed%20of%20database%20management%20systems.%20These%20new%20systems%20are%20known%20as%20NoSQL.%20NoSQL%20is%20a%20buzz%20word%20term%20first%20popularized%20in%20early%202009%20to%20describe%20a%20database%20that%20is%20non-SQL...%20NoSQL%20is%20a%20term%20for%20a%20loosely%20defined%20class%20of%20non-relational%20d" rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://designmoo.com/submit?url=http://www.catswhocode.com/blog/getting-started-with-couchdb-tutorial-a-beginners-guide&amp;title=Getting+started+with+CouchDB%3A+a+beginner%27s+guide&amp;body=Getting%20started%20with%20CouchDB%0D%0AApache%20CouchDB%20is%20one%20of%20a%20new%20breed%20of%20database%20management%20systems.%20These%20new%20systems%20are%20known%20as%20NoSQL.%20NoSQL%20is%20a%20buzz%20word%20term%20first%20popularized%20in%20early%202009%20to%20describe%20a%20database%20that%20is%20non-SQL...%20NoSQL%20is%20a%20term%20for%20a%20loosely%20defined%20class%20of%20non-relational%20d" rel="nofollow" title="Moo this on DesignMoo!">Moo this on DesignMoo!</a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/getting-started-with-couchdb-tutorial-a-beginners-guide&amp;title=Getting+started+with+CouchDB%3A+a+beginner%27s+guide&amp;body=Getting%20started%20with%20CouchDB%0D%0AApache%20CouchDB%20is%20one%20of%20a%20new%20breed%20of%20database%20management%20systems.%20These%20new%20systems%20are%20known%20as%20NoSQL.%20NoSQL%20is%20a%20buzz%20word%20term%20first%20popularized%20in%20early%202009%20to%20describe%20a%20database%20that%20is%20non-SQL...%20NoSQL%20is%20a%20term%20for%20a%20loosely%20defined%20class%20of%20non-relational%20d" rel="nofollow" title="Blend this!">Blend this!</a></li>
<li> <a href="http://reddit.com/submit?url=http://www.catswhocode.com/blog/getting-started-with-couchdb-tutorial-a-beginners-guide&amp;title=Getting+started+with+CouchDB%3A+a+beginner%27s+guide" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a></li>
<li> <a href="http://twitter.com/home?status=Getting+started+with+CouchDB%3A+a+beginner%27s+guide+-+http://tinyurl.com/yec2uhh+(via+@catswhocode)" rel="nofollow" title="Tweet This!">Tweet This!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/2d34f_sIqcPAumsko" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/getting-started-with-couchdb-a-beginner%e2%80%99s-guide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10+ useful code snippets to develop iPhone friendly websites</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-code-snippets-to-develop-iphone-friendly-websites/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-code-snippets-to-develop-iphone-friendly-websites/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 17:15:16 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[code snippets]]></category>
		<category><![CDATA[cookie indexof]]></category>
		<category><![CDATA[ESPN]]></category>
		<category><![CDATA[header location]]></category>
		<category><![CDATA[html document]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[ipod touch]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[viewport]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-code-snippets-to-develop-iphone-friendly-websites/</guid>
		<description><![CDATA[Detect iPhones and iPods using Javascript When developing for the iPhone and the iPod Touch, the first thing we have to do is obviously detect it, so we can apply specific code or styles to it. The following code snippets will detect iPhones and iPods using Javascript, and redirect those users to an iPhone specific [...]]]></description>
			<content:encoded><![CDATA[<h2>Detect iPhones and iPods using Javascript</h2>
<p>When developing for the iPhone and the iPod Touch, the first thing we have to do is obviously detect it, so we can apply specific code or styles to it. The following code snippets will detect iPhones and iPods using Javascript, and redirect those users to an iPhone specific page.</p>
<pre>if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
    if (document.cookie.indexOf("iphone_redirect=false") == -1) {
        window.location = "http://m.espn.go.com/wireless/?iphone&amp;i=COMR";
    }
}</pre>
<p><strong>Source: <a href="http://davidwalsh.name/detect-iphone">http://davidwalsh.name/detect-iphone</a></strong></p>
<h2>Detect iPhones and iPods using PHP</h2>
<p>Although the previous snippet works great, Javascript can be disabled on the iPhone. For this reason, you may prefer to use PHP in order to detect iPhones and iPods touch.</p>
<pre>if(strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'],'iPod')) {
    header('Location: http://yoursite.com/iphone');
    exit();
}</pre>
<p><strong>Source: <a href="http://davidwalsh.name/detect-iphone">http://davidwalsh.name/detect-iphone</a></strong></p>
<h2>Set iPhone width as the viewport</h2>
<p>How many times did you load a website in your iPhone and it just looked like a thumbnail? The reason of this is that the developer forgot to define the viewport (or didn&#8217;t know it existed). The <em>width=device-width</em> statement allows you to define the document width as being the same than the width of the iPhone screen. The two other statements are preventing the page from being scaled, which is useful if you&#8217;re developing an iPhone-only website. Otherwise, you can remove those statements.<br /> Defining a viewport is easy: Just insert the following meta in the head section of your html document.</p>
<pre>&lt;meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"&gt;</pre>
<p><strong>Source: <a href="http://www.engageinteractive.co.uk/blog/2008/06/19/tutorial-building-a-website-for-the-iphone/">http://www.engageinteractive.co.uk/blog/2008/06/19/tutorial-building-a-website-for-the-iphone/</a></strong></p>
<h2>Insert an iPhone specific icon</h2>
<p>When a user adds your page to the home screen, the iPhone will automatically use a screenshot of your website as an icon. But you can provide your own icon, which is definitely better.<br /> Defining a custom iPhone icon is easy: Simply paste the following in the <em>head</em> section of your html document. The image should be 57px by 57px in <em>.png</em> format. You do not need to add the shine or corners, as the iPhone will do that for you automatically.</p>
<pre>&lt;rel="apple-touch-icon" href="images/template/engage.png"/&gt;</pre>
<p><strong>Source: <a href="http://www.engageinteractive.co.uk/blog/2008/06/19/tutorial-building-a-website-for-the-iphone/">http://www.engageinteractive.co.uk/blog/2008/06/19/tutorial-building-a-website-for-the-iphone/</a></strong></p>
<h2>Prevent Safari from adjusting text size on rotate</h2>
<p>When you rotate the iPhone, Safari adjust text size. If for some reason you&#8217;d like to prevent this effect, simply use the following CSS declaration. It has to be inserted in your CSS file.<br /> The <em>-webkit-text-size-adjust</em> is a webkit-only CSS property that allow you to control text adjustment.</p>
<pre>html, body, form, fieldset, p, div, h1, h2, h3, h4, h5, h6 {
    -webkit-text-size-adjust:none;
}</pre>
<p><strong>Source: <a href="http://www.engageinteractive.co.uk/blog/2008/06/19/tutorial-building-a-website-for-the-iphone/">http://www.engageinteractive.co.uk/blog/2008/06/19/tutorial-building-a-website-for-the-iphone/</a></strong></p>
<h2>Detect iPhone orientation</h2>
<p>Due to the fact that the iPhone allow its users to view a page in both portrait and landscape modes, you may need to be able to detect in which mode the document is being read.<br /> This handy javascript function will detect the current iPhone orientation and will apply a specific CSS class so you can style it your way. Note that in this example, the CSS class is added to the <em>page_wrapper</em> ID. Replace it by the desired ID name (See line 24).</p>
<pre>window.onload = function initialLoad() {
    updateOrientation();
}

function updateOrientation(){
    var contentType = "show_";
    switch(window.orientation){
        case 0:
	contentType += "normal";
	break;

	case -90:
	contentType += "right";
	break;

	case 90:
	contentType += "left";
	break;

	case 180:
	contentType += "flipped";
	break;
    }
    document.getElementById("page_wrapper").setAttribute("class", contentType);
}</pre>
<p><strong>Source: <a href="http://www.engageinteractive.co.uk/blog/2008/06/19/tutorial-building-a-website-for-the-iphone/">http://www.engageinteractive.co.uk/blog/2008/06/19/tutorial-building-a-website-for-the-iphone/</a></strong></p>
<h2>Apply CSS styles to iPhones/iPods only</h2>
<p>Browser sniffing can be useful, but for many reasons it isn&#8217;t the best practice to detect a browser. If you&#8217;re looking for a cleaner way to apply CSS styles to the iPhone only, you should use th following. It has to be pasted on your regular CSS file.</p>
<pre>@media screen and (max-device-width: 480px){
    /* All iPhone only CSS goes here */
}</pre>
<p><strong>Source: <a href="http://csswizardry.com/2010/01/iphone-css-tips-for-building-iphone-websites/">http://csswizardry.com/2010/01/iphone-css-tips-for-building-iphone-websites/</a></strong></p>
<h2>Automatically re-size images for iPhones</h2>
<p>On recent websites, most images are above 480 pixels wide. Due to the iPhone small size, there&#8217;s a strong chance that images will break out of the wrapper area.<br /> Using the following CSS code, you&#8217;ll be able to automatically re-size the website images to 100%. As the device max width is 480px, images will never be wider.</p>
<pre>@media screen and (max-device-width: 480px){
    img{
        max-width:100%;
        height:auto;
    }
}</pre>
<p><strong>Source: <a href="http://csswizardry.com/2010/01/iphone-css-tips-for-building-iphone-websites/">http://csswizardry.com/2010/01/iphone-css-tips-for-building-iphone-websites/</a></strong></p>
<h2>Hide toolbar by default</h2>
<p>On a small screen such as the iPhone screen, a toolbar is useful but also wastes a lot of space. If you&#8217;d like to hide Safari toolbar by default when an iPhone visitor open your website, just implement the following javascript code.</p>
<pre>window.addEventListener('load', function() {
    setTimeout(scrollTo, 0, 0, 1);
}, false);</pre>
<p><strong>Source: <a href="http://articles.sitepoint.com/article/iphone-development-12-tips/2">http://articles.sitepoint.com/article/iphone-development-12-tips/2</a></strong></p>
<h2>Make use of special links</h2>
<p>Do you remember those &#8220;mailto&#8221; link that were very popular some years ago? This prefix automatically open the default email client used by the person who clicked on it. The iPhone has introduced two similar prefixes, tel and sms, which allows the person who clicked on it to phone or text automatically.<br /> I&#8217;m definitely not a fan of those, but maybe that will be useful to you. The only thing you have to do to implement this, is to paste the following anywhere on your html page.</p>
<pre>&lt;a href="tel:12345678900"&gt;Call me&lt;/a&gt;
&lt;a href="sms:12345678900"&gt;Send me a text&lt;/a&gt;</pre>
<p><strong>Source: <a href="http://articles.sitepoint.com/article/iphone-development-12-tips/3">http://articles.sitepoint.com/article/iphone-development-12-tips/3</a></strong></p>
<h2>Simulate :hover pseudo class</h2>
<p>As no one is using a mouse on the iPhone, the :hover CSS pseudo class isn&#8217;t used. Though, using some Javascript you can simulate the :hover pseudo class when the user will have his finger on a link.</p>
<pre>var myLinks = document.getElementsByTagName('a');
for(var i = 0; i &lt; myLinks.length; i++){
   myLinks[i].addEventListener('touchstart', function(){this.className = "hover";}, false);
   myLinks[i].addEventListener('touchend', function(){this.className = "";}, false);
}</pre>
<p>Once you added the code above to your document, you can start css styling:</p>
<pre>a:hover, a.hover {
    /* whatever your hover effect is */
}</pre>
<p><strong>Source: <a href="http://www.evotech.net/blog/2008/12/hover-pseudoclass-for-the-iphone/">http://www.evotech.net/blog/2008/12/hover-pseudoclass-for-the-iphone/</a></strong></p>
<p><em>Have you checked out the highly recommended <a href="http://www.catswhocode.com/blog/diw.html">Digging into WordPress</a> book by Chris Coyier and Jeff Starr?</strong></em></p>
<p><a href="http://www.catswhocode.com/blog/10-useful-code-snippets-to-develop-iphone-friendly-websites">10+ useful code snippets to develop iPhone friendly websites</a></p>
<div>
<ul>
<li> <a href="http://del.icio.us/post?url=http://www.catswhocode.com/blog/10-useful-code-snippets-to-develop-iphone-friendly-websites&amp;title=10%2B+useful+code+snippets+to+develop+iPhone+friendly+websites" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/10-useful-code-snippets-to-develop-iphone-friendly-websites&amp;title=10%2B+useful+code+snippets+to+develop+iPhone+friendly+websites" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.stumbleupon.com/submit?url=http://www.catswhocode.com/blog/10-useful-code-snippets-to-develop-iphone-friendly-websites&amp;title=10%2B+useful+code+snippets+to+develop+iPhone+friendly+websites" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/10-useful-code-snippets-to-develop-iphone-friendly-websites&amp;title=10%2B+useful+code+snippets+to+develop+iPhone+friendly+websites" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/10-useful-code-snippets-to-develop-iphone-friendly-websites&amp;title=10%2B+useful+code+snippets+to+develop+iPhone+friendly+websites&amp;body=Detect%20iPhones%20and%20iPods%20using%20Javascript%0D%0AWhen%20developing%20for%20the%20iPhone%20and%20the%20iPod%20Touch%2C%20the%20first%20thing%20we%20have%20to%20do%20is%20obviously%20detect%20it%2C%20so%20we%20can%20apply%20specific%20code%20or%20styles%20to%20it.%20The%20following%20code%20snippets%20will%20detect%20iPhones%20and%20iPods%20using%20Javascript%2C%20and%20redirect%20those%20users%20to%20a" rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://designmoo.com/submit?url=http://www.catswhocode.com/blog/10-useful-code-snippets-to-develop-iphone-friendly-websites&amp;title=10%2B+useful+code+snippets+to+develop+iPhone+friendly+websites&amp;body=Detect%20iPhones%20and%20iPods%20using%20Javascript%0D%0AWhen%20developing%20for%20the%20iPhone%20and%20the%20iPod%20Touch%2C%20the%20first%20thing%20we%20have%20to%20do%20is%20obviously%20detect%20it%2C%20so%20we%20can%20apply%20specific%20code%20or%20styles%20to%20it.%20The%20following%20code%20snippets%20will%20detect%20iPhones%20and%20iPods%20using%20Javascript%2C%20and%20redirect%20those%20users%20to%20a" rel="nofollow" title="Moo this on DesignMoo!">Moo this on DesignMoo!</a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/10-useful-code-snippets-to-develop-iphone-friendly-websites&amp;title=10%2B+useful+code+snippets+to+develop+iPhone+friendly+websites&amp;body=Detect%20iPhones%20and%20iPods%20using%20Javascript%0D%0AWhen%20developing%20for%20the%20iPhone%20and%20the%20iPod%20Touch%2C%20the%20first%20thing%20we%20have%20to%20do%20is%20obviously%20detect%20it%2C%20so%20we%20can%20apply%20specific%20code%20or%20styles%20to%20it.%20The%20following%20code%20snippets%20will%20detect%20iPhones%20and%20iPods%20using%20Javascript%2C%20and%20redirect%20those%20users%20to%20a" rel="nofollow" title="Blend this!">Blend this!</a></li>
<li> <a href="http://reddit.com/submit?url=http://www.catswhocode.com/blog/10-useful-code-snippets-to-develop-iphone-friendly-websites&amp;title=10%2B+useful+code+snippets+to+develop+iPhone+friendly+websites" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a></li>
<li> <a href="http://twitter.com/home?status=10%2B+useful+code+snippets+to+develop+iPhone+friendly+websites+-+http://tinyurl.com/ykhyexo+(via+@catswhocode)" rel="nofollow" title="Tweet This!">Tweet This!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/df915_Sbz4oYhwaik" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-code-snippets-to-develop-iphone-friendly-websites/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WordPress : 10+ life saving SQL queries</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/wordpress-10-life-saving-sql-queries/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/wordpress-10-life-saving-sql-queries/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 17:10:30 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[author attribution]]></category>
		<category><![CDATA[author id]]></category>
		<category><![CDATA[command line interpreter]]></category>
		<category><![CDATA[database backup]]></category>
		<category><![CDATA[database records]]></category>
		<category><![CDATA[md5 hash]]></category>
		<category><![CDATA[mysql command line]]></category>
		<category><![CDATA[sql queries]]></category>
		<category><![CDATA[web interface]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/wordpress-10-life-saving-sql-queries/</guid>
		<description><![CDATA[How to execute SQL queries For those who don&#8217;t know yet, SQL queries have to be executed within the MySQL command line interpreter or a web interface such as the popular PhpMyAdmin. Since we&#8217;re going to work on WordPress, you should note that the SQL Executionner plugin provides an easy-to-use interface that allows you to [...]]]></description>
			<content:encoded><![CDATA[<h2>How to execute SQL queries</h2>
<p>For those who don&#8217;t know yet, SQL queries have to be executed within the MySQL command line interpreter or a web interface such as the popular PhpMyAdmin. Since we&#8217;re going to work on WordPress, you should note that the <a href="http://justinsomnia.org/2008/02/the-wordpress-sql-executioner/">SQL Executionner</a> plugin provides an easy-to-use interface that allows you to run SQL queries directly on your WordPress blog dashboard.</p>
<p>Although all the queries from this article have been tested, don&#8217;t forget that you shouldn&#8217;t test any of those on a production blog. Also, make sure that you always have a working database backup.</p>
<h2>Manually change your password</h2>
<p>It may sound like the thing that only happens to others but forgetting a password can happen to any of us. In case you lost your blog admin password, the only solution is to create a new one directly in your MySQL database.<br /> The following query will do it. Notice that we use the MD5() MySQL function to turn our password into an MD5 hash.</p>
<pre>UPDATE 'wp_users' SET 'user_pass' = MD5('PASSWORD') WHERE 'user_login' ='admin' LIMIT 1;</pre>
<p><strong>Source : <a href="http://www.wprecipes.com/how-to-manually-reset-your-wordpress-password">http://www.wprecipes.com/how-to-manually-reset-your-wordpress-password</a></strong></p>
<h2>Transfer posts from one user to another</h2>
<p>Most WordPress newcomers tend to use the good old &#8220;admin&#8221; account instead of creating an account with their real name. If you made that mistake and created another account later, you can easily transfer your old &#8220;admin&#8221; posts to your new account with the SQL query below.<br /> You&#8217;ll need the user id of both your old and new accounts.</p>
<pre>UPDATE wp_posts SET post_author=NEW_AUTHOR_ID WHERE post_author=OLD_AUTHOR_ID;</pre>
<p><strong>Source : <a href="http://www.wprecipes.com/how-to-change-author-attribution-on-all-posts-at-once">http://www.wprecipes.com/how-to-change-author-attribution-on-all-posts-at-once</a></strong></p>
<h2>Delete post revisions and meta associated to those revisions</h2>
<p>Post revisions are very useful, especially in the case of a multi author blog. However, the problem of post revisions is definitely the number of database records it creates. For exemple, if your blog has 100 posts, which has 10 revisions each, you&#8217;ll end up with 1000 records in the wp_posts tables, while only 100 of them are necessary.<br /> Executing this query will delete all post revisions as well as all meta info (custom fields, etc) associated to it. The whole process will result in a consequent gain of database space.</p>
<pre>DELETE a,b,c FROM wp_posts a WHERE a.post_type = 'revision' LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id) LEFT JOIN wp_postmeta c ON (a.ID = c.post_id);</pre>
<p><strong>Source : <a href="http://www.onextrapixel.com/2010/01/30/13-useful-wordpress-sql-queries-you-wish-you-knew-earlier/">http://www.onextrapixel.com/2010/01/30/13-useful-wordpress-sql-queries-you-wish-you-knew-earlier/</a></strong></p>
<h2>Batch delete spam comments</h2>
<p>Imagine that you&#8217;re coming back from holidays, where you haven&#8217;t had any access to the Internet. If you haven&#8217;t installed Akismet and depending on your blog popularity, you may end up with 1000, 2000 or even 10,000 comments to moderate.<br /> You can spend a whole day to moderate the lot, or you can use this life-saving query to delete all unapproved comments. And for your next holidays, don&#8217;t forget to install Akismet!</p>
<pre>DELETE from wp_comments WHERE comment_approved = '0';</pre>
<p><strong>Source : <a href="http://www.wprecipes.com/mark-asked-how-to-batch-deleting-spam-comments-on-a-wordpress-blog">http://www.wprecipes.com/mark-asked-how-to-batch-deleting-spam-comments-on-a-wordpress-blog</a></strong></p>
<h2>Find unused tags</h2>
<p>Tags are recorded on the wp_terms table. If for some reason a tag has been created but is not used anymore, it stays in the table. This query will let you know which tags are on the wp_terms table without being used anywhere on your blog. You can delete those safely.</p>
<pre>SELECT * From wp_terms wt INNER JOIN wp_term_taxonomy wtt ON wt.term_id=wtt.term_id WHERE wtt.taxonomy='post_tag' AND wtt.count=0;</pre>
<p><strong>Source : <a href="http://www.onextrapixel.com/2010/01/30/13-useful-wordpress-sql-queries-you-wish-you-knew-earlier/">http://www.onextrapixel.com/2010/01/30/13-useful-wordpress-sql-queries-you-wish-you-knew-earlier/</a></strong></p>
<h2>Find and replace data</h2>
<p>This tip isn&#8217;t specific to WordPress and is a must know for anyone who&#8217;s working with MySQL databases. The MySQL function replace() lets you specify a field name, a string to find, and a replacement string. Once the query is executed, all occurrences of the string to replace will be replaced by the replacement string.<br /> In case of a WordPress blog, this can be useful to batch replace a typo (For example people who repeatedly call the software WordPress&#8230;) or an email address.</p>
<pre>UPDATE table_name SET field_name = replace( field_name, 'string_to_find', 'string_to_replace' ) ;</pre>
<p><strong>Source : <a href="http://perishablepress.com/press/2007/07/25/mysql-magic-find-and-replace-data/">http://perishablepress.com/press/2007/07/25/mysql-magic-find-and-replace-data/</a></strong></p>
<h2>Get a list of your commentators emails</h2>
<p>Have you ever received unsolicited emails from blogs you previously commented? I&#8217;m sure you did, just like me. The fact is that getting a list of emails from your commentators is extremely easy using the following query. The <em>DISTINCT</em> parameter will make sure that we&#8217;ll only get each email once, even if the user commented more than once.<br /> Please note that this is only a proof of concept: Don&#8217;t send your users unwanted emails.</p>
<pre>SELECT DISTINCT comment_author_email FROM wp_comments;</pre>
<p><strong>Source : <a href="http://www.onextrapixel.com/2010/01/30/13-useful-wordpress-sql-queries-you-wish-you-knew-earlier/">http://www.onextrapixel.com/2010/01/30/13-useful-wordpress-sql-queries-you-wish-you-knew-earlier/</a></strong></p>
<h2>Disable all your plugins at once</h2>
<p>When things go wrong, especially on a production site, you have to be quick. Considering the fact that plugins are often the source of problems, disabling all your plugins in a second can prevent lots of problems.<br /> Just run the following query:</p>
<pre>UPDATE wp_options SET option_value = '' WHERE option_name = 'active_plugins';</pre>
<p><strong>Source : <a href="http://www.wprecipes.com/how-to-disable-all-your-plugins-in-a-second">http://www.wprecipes.com/how-to-disable-all-your-plugins-in-a-second</a></strong></p>
<h2>Delete all tags</h2>
<p>In WordPress, tags are recorded in the wp_terms tables, along with categories and taxonomies. If you wish to remove all tags, you can&#8217;t simply empty or delete the wp_terms as you&#8217;ll destroy categories at the same time!<br /> If you want to get rid of your tags, run this query. It will remove all tags and relationships between tags and posts, while leaving categories and taxonomies intact.</p>
<pre>DELETE a,b,c
FROM
	database.prefix_terms AS a
	LEFT JOIN database.prefix_term_taxonomy AS c ON a.term_id = c.term_id
	LEFT JOIN database.prefix_term_relationships AS b ON b.term_taxonomy_id = c.term_taxonomy_id
WHERE (
	c.taxonomy = 'post_tag' AND
	c.count = 0
	);</pre>
<p><strong>Source : <a href="http://wordpress.org/support/topic/311665">http://wordpress.org/support/topic/311665</a></strong></p>
<h2>List unused post meta</h2>
<p>Post meta is created by plugins and custom fields. They are extremely useful, but they can quickly make your database grow in size. The following query will show you all the records in the postmeta table that doesn&#8217;t have corresponding records in the post table.</p>
<pre>SELECT * FROM wp_postmeta pm LEFT JOIN wp_posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL;</pre>
<p><strong>Source : <a href="http://wordpress.org/support/topic/337412">http://wordpress.org/support/topic/337412</a></strong></p>
<h2>Disable comments on older posts</h2>
<p>Everyone who has been in blogging for more than one year will know: Even after some months, your old posts still receive interest from the public and lots of comments, mostly because they are indexed by search engines. This is a good thing of course, but the problem is for people like me who own technical blogs and have to answer lots of questions related to their old (and sometimes obsolete) posts.<br /> The solution to this problem is to automatically close comments on posts which are too old. This SQL query will close comments on all posts published before January 1, 2009.</p>
<pre>UPDATE wp_posts SET comment_status = 'closed' WHERE post_date &lt; '2009-01-01' AND post_status = 'publish';</pre>
<p><strong>Source : <a href="http://perishablepress.com/press/2008/02/20/wordpress-discussion-management-enable-or-disable-comments-and-pingbacks-via-sql/">http://perishablepress.com/press/2008/02/20/wordpress-discussion-management-enable-or-disable-comments-and-pingbacks-via-sql/</a></strong></p>
<h2>Replace commentator url</h2>
<p>Previously in this article, I talked about the very useful replace() MySQL function. Here is a good example of how useful it is : Let&#8217;s say you previously own a site and used its url in your comments to generate backlinks to this site.<br /> If you sell the site, you can easily replace the old url by your new site url. Simply run this query and you&#8217;ll be done!</p>
<pre>UPDATE wp_comments SET comment_author_url = REPLACE( comment_author_url, 'http://oldurl.com', 'http://newurl.com' );</pre>
<p><strong>Source : <a href="http://perishablepress.com/press/2008/07/14/wordpress-link-author-comments-home-page/">http://perishablepress.com/press/2008/07/14/wordpress-link-author-comments-home-page/</a></strong></p>
<h2>Replace commentator email adress</h2>
<p>Another good example of the replace() function. This query will replace the email adress provided in the comments field, by a new one.</p>
<pre>UPDATE wp_comments SET comment_author_email = REPLACE( comment_author_email, 'old-email@address.com', 'new-email@address.com' );</pre>
<p><strong>Source : <a href="http://perishablepress.com/press/2008/05/18/wordpress-tip-update-email-address-in-the-wordpress-database/">http://perishablepress.com/press/2008/05/18/wordpress-tip-update-email-address-in-the-wordpress-database</a></strong></p>
<h2>Delete all comments with a specific url</h2>
<p>Lately, I&#8217;ve noticied that some clever spammers left some quite relevant comments, but with a link pointing to a viagra site. Unfortunely, when I noticied it the commentator already left lots of comments. The following query will delete all comments with a specific url. The &#8220;%&#8221; signs means that any url containing the string within the % signs will be deleted.</p>
<pre>DELETE from wp_comments WHERE comment_author_url LIKE "%wpbeginner%" ;</pre>
<p><strong>Source : <a href="http://perishablepress.com/press/2007/07/25/mysql-magic-find-and-replace-data/">http://perishablepress.com/press/2007/07/25/mysql-magic-find-and-replace-data/</a></strong></p>
<p><em>Have you checked out the highly recommended <a href="http://www.catswhocode.com/blog/diw.html">Digging into WordPress</a> book by Chris Coyier and Jeff Starr?</strong></em></p>
<p><a href="http://www.catswhocode.com/blog/wordpress-10-life-saving-sql-queries">WordPress : 10+ life saving SQL queries</a></p>
<div>
<ul>
<li> <a href="http://del.icio.us/post?url=http://www.catswhocode.com/blog/wordpress-10-life-saving-sql-queries&amp;title=WordPress+%3A+10%2B+life+saving+SQL+queries" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/wordpress-10-life-saving-sql-queries&amp;title=WordPress+%3A+10%2B+life+saving+SQL+queries" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.stumbleupon.com/submit?url=http://www.catswhocode.com/blog/wordpress-10-life-saving-sql-queries&amp;title=WordPress+%3A+10%2B+life+saving+SQL+queries" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/wordpress-10-life-saving-sql-queries&amp;title=WordPress+%3A+10%2B+life+saving+SQL+queries" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/wordpress-10-life-saving-sql-queries&amp;title=WordPress+%3A+10%2B+life+saving+SQL+queries&amp;body=How%20to%20execute%20SQL%20queries%0D%0AFor%20those%20who%20don%27t%20know%20yet%2C%20SQL%20queries%20have%20to%20be%20executed%20within%20the%20MySQL%20command%20line%20interpreter%20or%20a%20web%20interface%20such%20as%20the%20popular%20PhpMyAdmin.%20Since%20we%27re%20going%20to%20work%20on%20WordPress%2C%20you%20should%20note%20that%20the%20SQL%20Executionner%20plugin%20provides%20an%20easy-to-use%20inte" rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://designmoo.com/submit?url=http://www.catswhocode.com/blog/wordpress-10-life-saving-sql-queries&amp;title=WordPress+%3A+10%2B+life+saving+SQL+queries&amp;body=How%20to%20execute%20SQL%20queries%0D%0AFor%20those%20who%20don%27t%20know%20yet%2C%20SQL%20queries%20have%20to%20be%20executed%20within%20the%20MySQL%20command%20line%20interpreter%20or%20a%20web%20interface%20such%20as%20the%20popular%20PhpMyAdmin.%20Since%20we%27re%20going%20to%20work%20on%20WordPress%2C%20you%20should%20note%20that%20the%20SQL%20Executionner%20plugin%20provides%20an%20easy-to-use%20inte" rel="nofollow" title="Moo this on DesignMoo!">Moo this on DesignMoo!</a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/wordpress-10-life-saving-sql-queries&amp;title=WordPress+%3A+10%2B+life+saving+SQL+queries&amp;body=How%20to%20execute%20SQL%20queries%0D%0AFor%20those%20who%20don%27t%20know%20yet%2C%20SQL%20queries%20have%20to%20be%20executed%20within%20the%20MySQL%20command%20line%20interpreter%20or%20a%20web%20interface%20such%20as%20the%20popular%20PhpMyAdmin.%20Since%20we%27re%20going%20to%20work%20on%20WordPress%2C%20you%20should%20note%20that%20the%20SQL%20Executionner%20plugin%20provides%20an%20easy-to-use%20inte" rel="nofollow" title="Blend this!">Blend this!</a></li>
<li> <a href="http://reddit.com/submit?url=http://www.catswhocode.com/blog/wordpress-10-life-saving-sql-queries&amp;title=WordPress+%3A+10%2B+life+saving+SQL+queries" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a></li>
<li> <a href="http://twitter.com/home?status=WordPress+%3A+10%2B+life+saving+SQL+queries+-+http://tinyurl.com/yc2bwrw+(via+@catswhocode)" rel="nofollow" title="Tweet This!">Tweet This!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/dab03_M-qK1zvdcXI" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/wordpress-10-life-saving-sql-queries/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>10+ useful online code editors</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-online-code-editors/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-online-code-editors/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 17:03:30 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[collaborative work]]></category>
		<category><![CDATA[distractions]]></category>
		<category><![CDATA[editor features]]></category>
		<category><![CDATA[editpad]]></category>
		<category><![CDATA[handy tool]]></category>
		<category><![CDATA[line numbers]]></category>
		<category><![CDATA[programming languages]]></category>
		<category><![CDATA[repositories]]></category>
		<category><![CDATA[snippets]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-online-code-editors/</guid>
		<description><![CDATA[Amy Editor Created in 2007 by Petr Krontorád, Amy Editor is an advanced editor with a look and feel of a Mac. Amy Editor features lots of useful options, such as line numbers, syntax highlighting, snippets for more than 20 languages, collaboration, and more. Amy can edit, save and export files. It can also manage [...]]]></description>
			<content:encoded><![CDATA[<h2>Amy Editor</h2>
<p>Created in 2007 by Petr Krontorád, Amy Editor is an advanced editor with a look and feel of a Mac. Amy Editor features lots of useful options, such as line numbers, syntax highlighting, snippets for more than 20 languages, collaboration, and more.<br /> Amy can edit, save and export files. It can also manage projects.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/d0a91_amyeditor.png" alt="" /><br /> <strong>&raquo; <a href="http://www.amyeditor.com/">http://www.amyeditor.com/</a></strong></p>
<h2>JSBin</h2>
<p>As you can guess, JSBin is an online text editor primarily focused on Javascript. I really love the clean and simple interface. Each code can be tested using a powerful &#8220;Preview&#8221; feature, and then exported into a text file.<br /> Another good thing to note is that JSBin can import popular Javascript frameworks such as jQuery or Mootools, so you can test your js plugins as well.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/e3465_jsbin.png" alt="" /><br /> <strong>&raquo; <a href="http://jsbin.com/">http://jsbin.com/</a></strong></p>
<h2>Bespin</h2>
<p>Using HTML5 quite intensively, Bespin is a new project from Mozilla Labs. This online editor is very powerful and has lots of cool options. In order to use Bespin, you have to create an account. Note that Bespin can be downloaded and then embedded in any kind of web project, only by adding two files in your header!<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/df26c_bespin.png" alt="" /><br /> <strong>&raquo; <a href="https://bespin.mozilla.com/">https://bespin.mozilla.com/</a></strong></p>
<h2>Kodingen</h2>
<p>Kodingen is another great online editor, probably one of the most powerful tool on this whole list. It can be used unregistered or you can create an account to use advanced functions as such as SVN repositories, collaborative work, etc.<br /> This editor features templates for most programming languages, syntax highlighting, line numbering and more. A must!<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/de269_kodingen.png" alt="" /><br /> <strong>&raquo; <a href="http://kodingen.com/">http://kodingen.com/</a></strong></p>
<h2>EditPad</h2>
<p>Unlike the first few editors featured in this post, EditPad is simple and minimal. No syntax highlighting, no project management&#8230;Just a plain page to type your text without any distractions. I&#8217;m not a big fan, but this &#8220;online notepad&#8221; can be a life saver on a particularly slow machine.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/afc55_editpad.png" alt="" /><br /> <strong>&raquo; <a href="http://www.editpad.org/">http://www.editpad.org/</a></strong></p>
<h2>TypeIt</h2>
<p>TypeIt isn&#8217;t a code editor and I hesitated to feature it in this post. This handy tool helps you to access special characters such as French accents, like a visual keyboard does. Definitely a site to have in your bookmarks if you&#8217;re often working on multi-language sites.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/89a49_typeit.png" alt="" /><br /> <strong>&raquo; <a href="http://www.typeit.org/">http://www.typeit.org/</a></strong></p>
<h2>PractiCode</h2>
<p>PractiCode is a very basic code editor. It has very limited functions (Handles CSS, HTML and VbScript) but it is perfect to make quick and dirty code.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/ec09f_practicode.png" alt="" /><br /> <strong>&raquo; <a href="http://www.landofcode.com/online-code-editor.php">http://www.landofcode.com/online-code-editor.php</a></strong></p>
<h2>9ne</h2>
<p>9ne (Pronounced <em>Nine</em>) is a nice online text editor, based on the well known GNU Emacs. 9ne provides most of the basic Emacs functionalities and currently supports XML and Javascript syntax highlighting modes.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/d743a_9ne.png" alt="" /><br /> <strong>&raquo; <a href="http://robrohan.com/projects/9ne/">http://robrohan.com/projects/9ne/</a></strong></p>
<h2>jsvi</h2>
<p>Vi has always been one of my favorite text editors of all times. Why? Because it is powerful, fast, and you&#8217;ll find it everywhere: GNU/linux distros, Mac, web servers&#8230; Now, you&#8217;ll also find Vi online with this implementation called JSVI. Most Vi functions have been implemented into this web-based version.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/75d4a_jsvi.png" alt="" /><br /> <strong>&raquo; <a href="http://gpl.internetconnection.net/vi/">http://gpl.internetconnection.net/vi/</a></strong></p>
<h2>HTMLedit</h2>
<p>As the name says, HTMLedit is a (very basic) HTML editor that can be used for quick and dirty coding. However, its interest is limited, particularly if compared to most other items from this list.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/d459d_htmledit.png" alt="" /><br /> <strong>&raquo; <a href="http://htmledit.squarefree.com/">http://htmledit.squarefree.com/</a></strong></p>
<h2>DarkCopy</h2>
<p>Have you ever felt distracted when working on a buggy piece of code? If yes, there&#8217;s no doubt that you will enjoy DarkCopy. This simple online text editor has limited functions but it provides a dark, clutter-free environment so you can concentrate on the most important: getting things done.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/11060_darkcopy.png" alt="" /><br /> <strong>&raquo; <a href="http://darkcopy.com/">http://darkcopy.com/</a></strong></p>
<h2>SimpleText</h2>
<p>SimpleText.ws may have a cool retro Apple look, but it is also a powerful tool that allows you to create, edit, and save plain text files in your web browser. Another good point of SimpleText is that you can host it yourself if you want, using Google Apps Engine. <a href="http://knol.google.com/k/jon-skovron/host-your-own-simpletext-ws-site-with/dbugzkeb16uw/1">This guide</a> will show you how to do.<br /> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/81fbe_simpletext.png" alt="" /><br /> <strong>&raquo; <a href="http://www.simpletext.ws/">http://www.simpletext.ws/</a></strong></p>
<p><em>Have you checked out the highly recommended <a href="http://www.catswhocode.com/blog/diw.html">Digging into WordPress</a> book by Chris Coyier and Jeff Starr?</strong></em></p>
<p><a href="http://www.catswhocode.com/blog/10-useful-online-code-editors">10+ useful online code editors</a></p>
<div>
<ul>
<li> <a href="http://del.icio.us/post?url=http://www.catswhocode.com/blog/10-useful-online-code-editors&amp;title=10%2B+useful+online+code+editors" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a></li>
<li> <a href="http://digg.com/submit?phase=2&amp;url=http://www.catswhocode.com/blog/10-useful-online-code-editors&amp;title=10%2B+useful+online+code+editors" rel="nofollow" title="Digg this!">Digg this!</a></li>
<li> <a href="http://www.stumbleupon.com/submit?url=http://www.catswhocode.com/blog/10-useful-online-code-editors&amp;title=10%2B+useful+online+code+editors" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li>
<li> <a href="http://www.designfloat.com/submit.php?url=http://www.catswhocode.com/blog/10-useful-online-code-editors&amp;title=10%2B+useful+online+code+editors" rel="nofollow" title="Submit this to DesignFloat">Submit this to DesignFloat</a></li>
<li> <a href="http://designbump.com/submit?url=http://www.catswhocode.com/blog/10-useful-online-code-editors&amp;title=10%2B+useful+online+code+editors&amp;body=Amy%20Editor%0D%0ACreated%20in%202007%20by%20Petr%20Krontor%C3%A1d%2C%20Amy%20Editor%20is%20an%20advanced%20editor%20with%20a%20look%20and%20feel%20of%20a%20Mac.%20Amy%20Editor%20features%20lots%20of%20useful%20options%2C%20such%20as%20line%20numbers%2C%20syntax%20highlighting%2C%20snippets%20for%20more%20than%2020%20languages%2C%20collaboration%2C%20and%20more.%0D%0AAmy%20can%20edit%2C%20save%20and%20export%20files.%20I" rel="nofollow" title="Bump this on DesignBump">Bump this on DesignBump</a></li>
<li> <a href="http://designmoo.com/submit?url=http://www.catswhocode.com/blog/10-useful-online-code-editors&amp;title=10%2B+useful+online+code+editors&amp;body=Amy%20Editor%0D%0ACreated%20in%202007%20by%20Petr%20Krontor%C3%A1d%2C%20Amy%20Editor%20is%20an%20advanced%20editor%20with%20a%20look%20and%20feel%20of%20a%20Mac.%20Amy%20Editor%20features%20lots%20of%20useful%20options%2C%20such%20as%20line%20numbers%2C%20syntax%20highlighting%2C%20snippets%20for%20more%20than%2020%20languages%2C%20collaboration%2C%20and%20more.%0D%0AAmy%20can%20edit%2C%20save%20and%20export%20files.%20I" rel="nofollow" title="Moo this on DesignMoo!">Moo this on DesignMoo!</a></li>
<li> <a href="http://thewebblend.com/submit?url=http://www.catswhocode.com/blog/10-useful-online-code-editors&amp;title=10%2B+useful+online+code+editors&amp;body=Amy%20Editor%0D%0ACreated%20in%202007%20by%20Petr%20Krontor%C3%A1d%2C%20Amy%20Editor%20is%20an%20advanced%20editor%20with%20a%20look%20and%20feel%20of%20a%20Mac.%20Amy%20Editor%20features%20lots%20of%20useful%20options%2C%20such%20as%20line%20numbers%2C%20syntax%20highlighting%2C%20snippets%20for%20more%20than%2020%20languages%2C%20collaboration%2C%20and%20more.%0D%0AAmy%20can%20edit%2C%20save%20and%20export%20files.%20I" rel="nofollow" title="Blend this!">Blend this!</a></li>
<li> <a href="http://reddit.com/submit?url=http://www.catswhocode.com/blog/10-useful-online-code-editors&amp;title=10%2B+useful+online+code+editors" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a></li>
<li> <a href="http://twitter.com/home?status=10%2B+useful+online+code+editors+-+http://tinyurl.com/yabx4oj+(via+@catswhocode)" rel="nofollow" title="Tweet This!">Tweet This!</a></li>
</ul>
<div></div>
</div>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/81fbe_HOBaFuM_scY" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-useful-online-code-editors/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to easily monitor your web server using PHP</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-easily-monitor-your-web-server-using-php/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-easily-monitor-your-web-server-using-php/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 08:56:06 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[cellular phone provider]]></category>
		<category><![CDATA[check host]]></category>
		<category><![CDATA[cron jobs]]></category>
		<category><![CDATA[home server]]></category>
		<category><![CDATA[host host]]></category>
		<category><![CDATA[host www]]></category>
		<category><![CDATA[hostgator]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[strpos]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-easily-monitor-your-web-server-using-php/</guid>
		<description><![CDATA[Prerequisites Maybe I&#8217;m stating the obvious, but the PHP script has to be on a different server than the one used for the website you&#8217;d like to monitor. If the script is hosted on the same server than your site, it becomes pretty useless: In fact, if your server is down the script will not [...]]]></description>
			<content:encoded><![CDATA[<h2>Prerequisites</h2>
<p>Maybe I&#8217;m stating the obvious, but the PHP script has to be on a different server than the one used for the website you&#8217;d like to monitor. If the script is hosted on the same server than your site, it becomes pretty useless: In fact, if your server is down the script will not be able to run and will not let you know.<br /> The best solution is of course a dedicated server, but a home server can be ok as well. Shared web hosting like those provided by Hostgator or WpWebHost have a low price, but most don&#8217;t allow you to set up cron jobs, so be careful if you plan to buy.</p>
<p>The last part of this tutorial will show you how to get sms alerts using Gmail. Please note that depending on your location and cellular phone provider, this part of the tutorial may not work.</p>
<h2>1. Creating the monitoring script</h2>
<p>The first part of this tutorial is to create the monitor script. Pick up your favorite text editor and create a file named <em>monitor.php</em>. The script is very simple: we only need two functions, one to test if a specific site is available, and the other to alert you by sending an email.</p>
<p>Paste the following in your <em>monitor.php</em> file:</p>
<pre>function check($host, $find) {
    $fp = fsockopen($host, 80, $errno, $errstr, 10);
    if (!$fp) {
        echo "$errstr ($errno)\n";
    } else {
       $header = "GET / HTTP/1.1\r\n";
       $header .= "Host: $host\r\n";
       $header .= "Connection: close\r\n\r\n";
       fputs($fp, $header);
       while (!feof($fp)) {
           $str .= fgets($fp, 1024);
       }
       fclose($fp);
       return (strpos($str, $find) !== false);
    }
}

function alert($host) {
    mail('youremail@gmail.com', 'Monitoring', $host.' down');
}

$host = 'www.catswhoblog.com';
$find = 'Cats Who Code';
if (!check($host, $find)) alert($host);</pre>
<p>The first function we created here, <em>check()</em>, takes two parameters: The first is the server you&#8217;d like to check availability (for example, www.catswhocode.com) and the second parameter is to find some text on the webpage. This second parameter is an additional security: In fact, by checking if a specific word is contained on the site homepage, we ensure that the site content hasn&#8217;t been modified, for example, after a hacking.</p>
<p>If the server isn&#8217;t available or if the text to find hasn&#8217;t been found, the <em>alert()</em> function is executed, and will send an email to the account of your choice.</p>
<p>Save the <em>monitor.php</em> file and upload it to your monitoring server.</p>
<h2>2. Defining a cron job</h2>
<p>At this point of the tutorial, we have a working monitoring script, but we have to type http://mymonitoringserver.com/monitor.php in a web browser to check our website, which makes our script almost useless.<br /> The solution to that problem is to create a cron task to make the server execute monitor.php every hour. Open a SSH console to your monitor server and type the following:</p>
<pre>0 * * * * /usr/local/bin/php -q /htdocs/www/monitor.php</pre>
<p>If your PHP scripts do not have executable permissions, 644 or -rw-r&#8211;r&#8211; for example, then as part of the command portion of the cron line, you must specify the php interpreter and pass it the filename of the PHP script (including full path to the script from your home directory) that you want executed.</p>
<h2>3. Setting up SMS alerts</h2>
<p>Right now, we have a working monitoring PHP script, as well as a cron job that will execute the script every hour. If a problem happens, you&#8217;ll receive an email.<br /> Due to the popularity of iPhones, Blackberries and other SmartPhones, a lot of people are able to receive emails everywhere they are. Though, some are still using cell phones with no email capability. In this optional step of the tutorial, let&#8217;s see how we can easily receive alerts by sms.</p>
<p>Doing so is quite easy. First you have to use Gmail. As it is a free service, you can create a dedicated account for your monitoring alerts. Once finished, login to your account and click on the &#8220;Settings&#8221; link located on the top right side of the browser window.<br /> Then, select &#8220;Forwarding and POP/IMAP&#8221;:<br /> <img src="http://www.catswhocode.com/blog/wp-content/uploads/2010/01/forward-email-sms-gmail.png" alt="" /><br /> As shown in the previous screenshot, the only thing you have to do is to check &#8220;Forward a copy of incomming mail&#8221; and fill the field with your phone number @ your provider service.<br /> For example, If your phone provider is AT&amp;T, you&#8217;ll have to type <em>0000000000@mobile.att.net</em>.</p>
<p><em>Have you checked out the highly recommended <a href="http://www.catswhocode.com/blog/diw.html">Digging into WordPress</a> book by Chris Coyier and Jeff Starr?</strong></em></p>
<p><a href="http://www.catswhocode.com/blog/how-to-easily-monitor-your-web-server-using-php">How to easily monitor your web server using PHP</a></p>
<p> <img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/56776_JjknEfgQz44" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/how-to-easily-monitor-your-web-server-using-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>10 interesting projects from Google Code</title>
		<link>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-interesting-projects-from-google-code/</link>
		<comments>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-interesting-projects-from-google-code/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 06:34:29 +0000</pubDate>
		<dc:creator>Facebook-Web-Design</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[clipboard]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Minify]]></category>
		<category><![CDATA[page loading]]></category>
		<category><![CDATA[swf file]]></category>
		<category><![CDATA[tinyurl]]></category>
		<category><![CDATA[Visit]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wordpress themes]]></category>

		<guid isPermaLink="false">http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-interesting-projects-from-google-code/</guid>
		<description><![CDATA[ZeroClipboard Do you remember the old days of web development, when IE6 was the king? (ok, it sounds soooo bad now but if you were already building sites in 2002 you know what I&#8217;m talking about!) It was extremely easy to force copy to clipboard. But, for obvious security concerns, Firefox doesn&#8217;t allow clipboard access [...]]]></description>
			<content:encoded><![CDATA[<h2>ZeroClipboard</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/793b3_zeroclipboard.jpg" alt="" /><br />
Do you remember the old days of web development, when IE6 was the king? (ok, it sounds soooo bad now but if you were already building sites in 2002 you know what I&#8217;m talking about!) It was extremely easy to force copy to clipboard.<br />
But, for obvious security concerns, Firefox doesn&#8217;t allow clipboard access by default. This is a good thing, but for some sites, being able to copy into clipboard is a must.</p>
<p>Using powerful Javascript and a .swf file, ZeroClipboard allow you copy information into the user clipboard. For a live demo, just have a look to my <a href="http://couponsforbloggers.com">Coupons For Bloggers</a> site.<br />
<strong>» <a href="http://code.google.com/p/zeroclipboard/">Visit ZeroClipboard</a></strong></p>
<h2>yourls</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/793b3_yourls.jpg" alt="" /><br />
As a blogger, I know how important Twitter is to stay tuned with my readers and share my favorite links with them. But as you know, Twitter allows only 140 characters in messages. In order to create shorter urls, you can use a service like bit.ly or Tinyurl.com, or you can get yourls, and create your own service.</p>
<p>Yourls is built in PHP and is very easy to configure. If you&#8217;re using WordPress, you&#8217;ll probably be happy to know that yourls has its own WordPress plugin.<br />
<strong>» <a href="http://code.google.com/p/yourls/">Visit Yourls</a></strong></p>
<h2>Minify</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/97ee2_minify.jpg" alt="" /><br />
I know I already talked about Minify in a previous article, but I simply cannot resist to spread the word about this very cool piece of code.<br />
Minify is extremely simple to install and will combine, minify, and cache JavaScript and CSS files on demand to speed up page loading.</p>
<p>Installing minify is extremely easy: you just have to upload  a directory to your site document root and Minify will start to speed up your blog. Wonderful, isn&#8217;t it?<br />
<strong>» <a href="http://code.google.com/p/minify/">Visit Minify</a></strong></p>
<h2>Thematic</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/97ee2_thematic.jpg" alt="" /><br />
Being a WordPress fan, I really love the concept of Theme frameworks. For those who doesn&#8217;t know what it is, Theme frameworks are WordPress themes which contain lots of functions and styles. You can extend both in looks and functionality by adding a child theme.<br />
For example, my other blog <a href="http://www.catswhoblog.com">Cats Who Blog</a> is using the Thesis theme framework that I extended using my own styles and functions.</p>
<p>Many commercial frameworks are availables, but Thematic is 100% free. A definitive <em>must download</em> if you&#8217;re into WordPress!<br />
<strong>» <a href="http://code.google.com/p/thematic/">Visit Thematic</a></strong></p>
<h2>Flexlib</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/1326f_flexlib.jpg" alt="" /><br />
As you may guess, Flexlib is an open source Adobe Flex library. It provides lots of components that you can freely use in your Flex or Air projects.<br />
The currently available components include: AdvancedForm, Base64Image, EnhancedButtonSkin, CanvasButton, ConvertibleTreeList, Draggable Slider, Fire, Highlighter, HorizontalAxisDataSelector IconLoader, ImageMap, PromptingTextArea, PromptingTextInput, Scrollable Menu Controls, SuperTabNavigator, Alternative Scrolling Canvases, Horizontal Accordion, TreeGrid, FlowBox, Docking ToolBar, and Flex Scheduling Framework.<br />
<strong>» <a href="http://code.google.com/p/flexlib/">Visit Flexlib</a></strong></p>
<h2>Zen Coding</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/1326f_zencoding.jpg" alt="" /><br />
As a web developer, I often find it frustrating having to type lots of tags and attributes to reach the desired result. HTML tags are necessary of course, but that doesn&#8217;t mean it should consume so much typing.<br />
This may be the idea Sergey Chikuyonok before he started to develop Zen Coding. What is Zen Coding? It is a handy set of tools for high-speed HTML and CSS coding. It integrate in your favorite text editor and then provide functions and shortcuts to speed up your development.</p>
<p>As an example, if you type this:</p>
<pre>div#content&gt;h1+p</pre>
<p>You&#8217;ll get the following output:</p>
<pre>&lt;div id="content"&gt;
&lt;h1&gt;&lt;/h1&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/div&gt;</pre>
<p>If you want to know more about Zen Coding, Smashing Magazine has <a href="http://www.smashingmagazine.com/2009/11/21/zen-coding-a-new-way-to-write-html-code/">a nice article</a> about it.<br />
<strong>» <a href="http://code.google.com/p/zen-coding/">Visit Zen Coding</a></strong></p>
<h2>Sexybuttons</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/1326f_sexybuttons.jpg" alt="" /><br />
On the internet, design matters. Some people are good for designing, some, like me, aren&#8217;t. Happilly, those who aren&#8217;t designers (or who are bad designers!!) should take advantage of projects like this one.<br />
Sexybuttons is a small CSS framework that allow you to instantanely create gorgeous buttons for your blog, websites and web apps. If you like CSS buttons, don&#8217;t forget to have a look to my <a href="http://www.catswhocode.com/blog/top-10-css-buttons-tutorial-list">Top 10 CSS buttons tutorial list</a>.<br />
<strong>» <a href="http://code.google.com/p/sexybuttons/">Visit Sexybuttons</a></strong></p>
<h2>jQuery transmit</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/27b98_upload.jpg" alt="" /><br />
Who doesn&#8217;t like jQuery? This very handy Javascript framework allows developers to enhance both the design and usability of your website. Thanks to plugins, jQuery can be easily enhanced with the functionalities you need. There&#8217;s a bunch of very cool jQuery plugins available from Google code so it was very hard to choose one. However, file upload has always been a major problem in web development and this jQuery plugin will be extremely helpful.</p>
<p>Using jQuery transmit is incredibely easy :</p>
<pre>$(document).ready(function() {
    var options = {
        allowedFileTypes: [{
            description: "Images",
            extensions: "*.jpg; *.gif; *.png"
        }]
    };

    $("#transmit").transmit("http://mysite.com/upload/", options);
})</pre>
<p><strong>» <a href="http://code.google.com/p/jquery-transmit/">Visit jQuery Transmit</a></strong></p>
<h2>dompdf : Convert HTML to PDF using PHP</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/27b98_dompdf.jpg" alt="" /><br />
The PDF format is useful for many thing such as invoices, and is largely used in business. dompdf is an advanced HTML to PDF converted which can download and read external stylesheets, inline style tags, and the style attributes of individual HTML elements. It also supports most presentational HTML attributes.<br />
<strong>» <a href="http://code.google.com/p/dompdf/">Visit dompdf</a></strong></p>
<h2>stop-spam</h2>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/27b98_stopspam.jpg" alt="" /><br />
Spam is definitely a big problem for blogs and websites. Although it is still impossible to completely prevent spam, some tools can help you a lot to fight it.<br />
Stop-spam is one of those tools. It is lightweight, compatible with all blogs and forums (WordPress, PhpBB, Movable Type, etc) and easy to install. It automatically blacklists well known domains and IPs used by spammers. Of course, you can edit lists to blacklist/whitelist to add more domains and IPs.<br />
<strong>» <a href="http://code.google.com/p/stop-spam-referer-php-script/">Visit stop-spam</a></strong></p>
<p><strong><em>Any other you&#8217;d like to mention? Don&#8217;t hesitate to let me know in a comment!</em></strong></p>
<p><em>Have you checked out the highly recommended <a href="http://www.catswhocode.com/blog/diw.html">Digging into WordPress</a> book by Chris Coyier and Jeff Starr?</strong></em></p>
<p><a href="http://www.catswhocode.com/blog/10-interesting-projects-from-google-code">10 interesting projects from Google Code</a></p>
<p><img src="http://www.neurosoftware.ro/programming-blog/wp-content/plugins/wp-o-matic/cache/0f494_O3vxulVb0jM" height="1" width="1" /><br />
<a href="http://feeds2.feedburner.com/Catswhocode">Go to Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.neurosoftware.ro/programming-blog/facebook-web-design/php/10-interesting-projects-from-google-code/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

