<?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>Envex Labs &#187; Articles</title>
	<atom:link href="http://envexlabs.com/category/articles/feed/" rel="self" type="application/rss+xml" />
	<link>http://envexlabs.com</link>
	<description>Freelance web development company of Matt Vickers</description>
	<lastBuildDate>Tue, 31 Aug 2010 14:02:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>LabsTabs &#8211; The Beginning</title>
		<link>http://envexlabs.com/2010/04/labstabs-the-beginning/</link>
		<comments>http://envexlabs.com/2010/04/labstabs-the-beginning/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 14:36:33 +0000</pubDate>
		<dc:creator>Matt Vickers</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://envexlabs.com/?p=383</guid>
		<description><![CDATA[I&#8217;m working on a project for a client and had an idea for the top navigation. The first draft just slid up a background sprite to reveal the tab. My co-workers did not like this as it looked awkward. This is where LabsTab 1.0 was created. The Goal In a perfect world the tab would [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a project for a client and had an idea for the top navigation.</p>
<p>The first draft just slid up a background sprite to reveal the tab. My co-workers did not like this as it looked awkward.</p>
<p>This is where LabsTab 1.0 was created.</p>
<h3>The Goal</h3>
<p>In a perfect world the tab would slide up, the text would fade from grey to white and everyone would be happy. My initial goal is to have the text use <a href="http://cufon.shoqolate.com/generate/" target="_blank">Cufon</a> to replace the text but it will require some keen thinking and a bit of Cufon.refresh();</p>
<h3>The Current State</h3>
<p>Right now the tab is split into 2 background images.</p>
<p>The Tab Background &amp; The Text</p>
<p>When the user rolls over the link, the tab slides up. This is good. The bad part is the text background doesn&#8217;t fade into the new background because by default jQuery wants to animate the background position.</p>
<p>Also it is very poorly coded, I&#8217;ve moved from MooTools to jQuery so I&#8217;m still a tad unfamiliar with things.</p>
<h3>The Code</h3>
<p>I&#8217;ve uploaded the entire project to github so feel free to fork it and make it better!</p>
<p><a href="http://github.com/envex/LabsTab">http://github.com/envex/LabsTab</a></p>
]]></content:encoded>
			<wfw:commentRss>http://envexlabs.com/2010/04/labstabs-the-beginning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter @anywhere</title>
		<link>http://envexlabs.com/2010/04/twitter-anywhere/</link>
		<comments>http://envexlabs.com/2010/04/twitter-anywhere/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 21:42:00 +0000</pubDate>
		<dc:creator>Matt Vickers</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://envexlabs.com/?p=378</guid>
		<description><![CDATA[Twitter @Anywhere is an easy to deploy solution for bringing the Twitter communication platform to your own site. Add follow buttons, hovercards, linkify @usernames, and build deeper integrations with &#8220;Connect to Twitter.&#8221; @Anywhere promotes a more engaged user base for your site. Just installed Twitter&#8217;s new @anywhere service. Just hover over my name @envex to [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Twitter @Anywhere is an easy to deploy solution for bringing the Twitter communication platform to your own site. Add follow buttons, hovercards, linkify @usernames, and build deeper integrations with &#8220;Connect to Twitter.&#8221; @Anywhere promotes a more engaged user base for your site.</p></blockquote>
<p>Just installed Twitter&#8217;s new <a href="http://dev.twitter.com/anywhere/" target="_blank">@anywhere</a> service. Just hover over my name @envex to test it out!</p>
]]></content:encoded>
			<wfw:commentRss>http://envexlabs.com/2010/04/twitter-anywhere/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DiggDugg: Getting the Gist of it.</title>
		<link>http://envexlabs.com/2009/12/diggdugg-getting-the-gist-of-it/</link>
		<comments>http://envexlabs.com/2009/12/diggdugg-getting-the-gist-of-it/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 05:21:59 +0000</pubDate>
		<dc:creator>Matt Vickers</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[mootools]]></category>

		<guid isPermaLink="false">http://envexlabs.com/?p=303</guid>
		<description><![CDATA[I&#8217;m starting to force myself to write more classes. It&#8217;s something I&#8217;ve always been interested in, but could never pull myself away from the linear design patterns that I&#8217;d become so comfortable with. I&#8217;ve written a class based on some basic functions of Digg.com that I&#8217;m planning on using for a tutorial. I wouldn&#8217;t be [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m starting to force myself to write more classes. It&#8217;s something I&#8217;ve always been interested in, but could never pull myself away from the linear design patterns that I&#8217;d become so comfortable with.</p>
<p>I&#8217;ve written a class based on some basic functions of <a href="http://digg.com" target="_blank">Digg.com</a> that I&#8217;m planning on using for a tutorial. I wouldn&#8217;t be a very good teacher if I released a shoddy class out to the masses.<span id="more-303"></span></p>
<p><img class="alignleft size-full wp-image-311" title="digdug" src="http://envexlabs.com/wp-content/uploads/2009/12/digdug.png" alt="digdug" width="90" height="90" />This is where you come in. I would like anyone and everyone to take this class and tear it apart. Call me an idiot for doing something a certain way, praise me for a chunk of code or make changes in silence. I want this to be a learning experience for everyone.</p>
<p>You can fork it, download it or copy it from my <a href="http://gist.github.com/245002" target="_blank">gist account</a> or use the big button below!</p>
<p><a href="http://gist.github.com/245002" target="_blank"><img class="alignnone size-full wp-image-304" title="download_source" src="http://envexlabs.com/wp-content/uploads/2009/12/download_source.png" alt="download_source" width="550" height="108" /></a></p>
<p>You can either contact me on gist, leave a comment or<a href="#contact"> send me an email</a>, either way lets try and make this a kick ass class!</p>
<p><small>DigDug Icon is copyright <a href="http://gedblog.com/" target="_blank">Gedeon Maheux</a> &amp; <a href="http://iconfactory.com/freeware/preview/arcd" target="_blank">The IconFactory</a></small></p>
<p><small>DIGG, DIGG IT, DUGG, DIGG THIS, Digg graphics, logos, designs, page headers, button icons, scripts, and other service names are the trademarks of Digg Inc.</small></p>
]]></content:encoded>
			<wfw:commentRss>http://envexlabs.com/2009/12/diggdugg-getting-the-gist-of-it/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Styling WordPress Comments</title>
		<link>http://envexlabs.com/2009/11/styling-wordpress-comments/</link>
		<comments>http://envexlabs.com/2009/11/styling-wordpress-comments/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 17:53:32 +0000</pubDate>
		<dc:creator>Matt Vickers</dc:creator>
				<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://envexlabs.com/?p=290</guid>
		<description><![CDATA[Styling the WordPress comments can be a pain if you don&#8217;t know what you&#8217;re doing. You have to wade through functions and files to finally get what you want. Luckily, we can write our own comment function, using our own code, to make styling the comments 100% easier and 50% more fun The Function In [...]]]></description>
			<content:encoded><![CDATA[<p>Styling the WordPress comments can be a pain if you don&#8217;t know what you&#8217;re doing. You have to wade through functions and files to finally get what you want.</p>
<p>Luckily, we can write our own comment function, using our own code, to make styling the comments 100% easier and 50% more fun <img src='http://envexlabs.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p><span id="more-290"></span></p>
<h3>The Function</h3>
<p>In your WordPress theme folder (root/wp-content/themes/your-theme/) there will be a file called <strong>functions.php</strong>. This is the first file we are going to edit, so open it up. Add this code to the bottom of <strong>functions.php</strong>.</p>
<pre name="code" class="php">
&lt;?php

function envex_comments($comment, $args, $depth) {

$GLOBALS['comment'] = $comment;

//grab the commenter id
$user_id = $comment-&gt;user_id;
$user = new WP_User( $user_id );

//set the current role of that commenter to the role variable
//most of the time, you'll just be worrying about you, the administrator
$role = isset($user) ? $user-&gt;roles[0] : ''; ?&gt;

&lt;li &lt;?php echo $oddcomment; ?&gt;id="comment-&lt;?php comment_ID() ?&gt;"&gt;

&lt;div&gt;
&lt;?php if(function_exists('get_avatar')) { echo get_avatar($comment, '45'); } ?&gt;
&lt;p&gt;&lt;strong&gt;&lt;?php comment_author_link() ?&gt;&lt;/strong&gt;&lt;br /&gt;&lt;?php comment_date('m/d/y \@ h:m a') ?&gt;&lt;/p&gt;

&lt;/div&gt; &lt;!-- comment_grav --&gt;

&lt;div&gt;
&lt;?php comment_text() ?&gt;
&lt;/div&gt; &lt;!-- comment_text --&gt;

&lt;div&gt;
&lt;?php comment_reply_link(array_merge( $args, array('depth' =&gt; $depth, 'max_depth' =&gt; $args['max_depth']))) ?&gt;
&lt;/div&gt;

&lt;?php
if ($comment-&gt;comment_approved == '0') : ?&gt;
&lt;p&gt;&lt;em&gt;Your comment is awaiting moderation.&lt;/em&gt;&lt;/p&gt;
&lt;?php
endif; ?&gt;

&lt;/li&gt;

&lt;?php
/* Changes every other comment to a different class */
$oddcomment = ( empty( $oddcomment ) ) ? 'class="alt" ' : '';

}

?&gt;
</pre>
<p>In a nutshell, WordPress is going to run this function for each comment.</p>
<p>We&#8217;ve created an li element that will hold all of our comment info.</p>
<p><strong>The Gravatar</strong></p>
<p>The first div, <strong>comment_grav</strong>, will display a gravatar is the current commenter has one setup. We use get_avatar($comment, &#8217;45&#8242;) and pass 2 variables to it. The first one being the comment info and the second is the size of our gravatar.</p>
<p>You can read more about <a href="http://en.gravatar.com/" target="_blank">gravatars over at their website</a>!</p>
<p><strong>The Comment Text and The Reply Link<br />
</strong></p>
<p>These next 2 functions are pretty straight forward. To display the comment text we use <em><strong>comment_text()</strong></em>.</p>
<p>To display the reply link we use the <em><strong>comment_reply_link()</strong></em>. The arguments that are being passed are to deal with threaded comments (*if they&#8217;re enabled).</p>
<p><em>*Threaded comments are enabled in Admin panel –&gt; Settings -&gt; Discussions.</em></p>
<p><strong>The Approval</strong></p>
<p>We don&#8217;t want to show any unapproved comments, so we check to see if <em>$comment-&gt;comment_approved </em>is false. If it&#8217;s false we display that it&#8217;s awaiting moderation.</p>
<h3>The Template</h3>
<p>Now that we&#8217;ve created our own comments function, we need to tell our theme to use it instead of the WordPress one. Open <strong>comments.php</strong> and find <em><strong>wp_list_comments()</strong></em>.<em><strong> </strong></em>It should be around line 29.</p>
<p>We are going to pass a few arguments to this function.</p>
<pre name="code" class="php">
wp_list_comments(array('reply_text'=&gt;'Reply to this Comment','type'=&gt;'comment','callback' =&gt; 'envex_comments'));
</pre>
<p>These arguments tell the <em><strong>wp_list_comments() </strong></em>function to use <em><strong>envex_comments() </strong></em>to display our comments.</p>
<h3>Conclusion</h3>
<p>You now have the basic structure for some new comments on your blog/cms. All that&#8217;s left is to style them up to match your site, and i&#8217;m going to leave that up to you!</p>
]]></content:encoded>
			<wfw:commentRss>http://envexlabs.com/2009/11/styling-wordpress-comments/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simple Templates: Easy as Pie</title>
		<link>http://envexlabs.com/2009/11/simple-templates-easy-as-pie/</link>
		<comments>http://envexlabs.com/2009/11/simple-templates-easy-as-pie/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 18:27:09 +0000</pubDate>
		<dc:creator>Matt Vickers</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://envexlabs.com/?p=247</guid>
		<description><![CDATA[The Problem I&#8217;m working on a project and have to generate the same template on 4 different pages. I was also using javascript to create the same template on the fly. Needless to say this wasn&#8217;t the most efficient way of doing things because if I needed to change 1 aspect of the template, I [...]]]></description>
			<content:encoded><![CDATA[<h3>The Problem</h3>
<p>I&#8217;m working on a project and have to generate the same template on 4 different pages. I was also using javascript to create the same template on the fly. Needless to say this wasn&#8217;t the most efficient way of doing things because if I needed to change 1 aspect of the template, I needed to edit 4 different files.</p>
<p>I tried to write a little function, inspired by <a href="http://cakephp.org/" target="_blank">CakePHP</a>, that would take an array of information, open up a template, replace any text and then return the new content.<span id="more-247"></span></p>
<p>This means I can use 1 template over and over again throughout the app and not have to worry if I made changes to all the files.</p>
<h3>The Function</h3>
<pre name="code" class="php">//grab an element to use as a template
function show_element($name, $array, $path = null){

//add .php do the end of the name, by default it looks for a relative path
//unless $path is avaiable, then it'll check the path
$name = $path . $name.'.php';

//open up the file
$content = fread($fp = fopen($name, 'r'), filesize($name)); fclose($fp);

//loop through the file and replace any content that's needed
//inside the template $array['name'] is {NAME}
foreach($array as $a =&gt; $b){

//just in case, uppercase the array name
$el = '{' . strtoupper($a) . '}';

//replace the content
$content = preg_replace("/$el/", $b, $content);

}

//return the content, woop woop
return $content;

}</pre>
<h3>Simple Usage</h3>
<p><em><strong>element.php<br />
</strong></em>We have our element file called <em><strong>element.php</strong></em>. Inside we have wrote out a simple line of text. We want the product name as well as the price to change depending on the information that we&#8217;ve passed through our function. Curly braces are our friends, so we wrap our variables in them. <strong>{NAME}</strong> will become the product name and <strong>{PRICE}</strong> the price.</p>
<p><em>NOTE: All the variable names in the template file must be uppercase and wrapped in curly braces or else they will not be replaced.</em></p>
<pre name="code" class="php">&lt;p&gt;By this product &lt;strong&gt;({NAME})&lt;/strong&gt; for the awesome price of ${PRICE}&lt;/p&gt;</pre>
<p><em><strong>index.php<br />
</strong></em>Our second file we have our <em><strong>$products</strong></em> array with 4 simple products. We are looping though each product and using our <em><strong>show_element()</strong></em> function to replace the variables in our template file with our product information.</p>
<pre name="code" class="php">$products = array(
array('name' =&gt; 'awesome shoes', 'price' =&gt; '99.99'),
array('name' =&gt; 'awesome pants', 'price' =&gt; '9.99'),
array('name' =&gt; 'awesome hats', 'price' =&gt; '19.99'),
array('name' =&gt; 'awesome woop woops', 'price' =&gt; '3459.99')
);

foreach($products as $product){

echo show_element('element', $product);

}</pre>
<p>Now we have a super simple, but very helpful template system that&#8217;s easy to use and install in any project!</p>
]]></content:encoded>
			<wfw:commentRss>http://envexlabs.com/2009/11/simple-templates-easy-as-pie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code for the Uncoded: Foreach Loops</title>
		<link>http://envexlabs.com/2009/11/code-for-the-uncoded-foreach-loops/</link>
		<comments>http://envexlabs.com/2009/11/code-for-the-uncoded-foreach-loops/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 18:08:36 +0000</pubDate>
		<dc:creator>Matt Vickers</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Code for the Decoded]]></category>
		<category><![CDATA[code4uncoded php]]></category>

		<guid isPermaLink="false">http://envexlabs.com/?p=232</guid>
		<description><![CDATA[Getting started with any type of language can be difficult for some people. Most tutorials or examples use a lot of &#8220;developer terms&#8221; that a designer or beginner won&#8217;t be familiar with. This can add another level of difficulty to otherwise simple tasks. This is hopefully where Code for the Uncoded comes in. Learning something [...]]]></description>
			<content:encoded><![CDATA[<p>Getting started with any type of language can be difficult for some people. Most tutorials or examples use a lot of &#8220;developer terms&#8221; that a designer or beginner won&#8217;t be familiar with. This can add another level of difficulty to otherwise simple tasks. This is hopefully where <strong>Code for the Uncoded</strong> comes in.<span id="more-232"></span></p>
<p>Learning something new is always easier when it&#8217;s put into real world terms. In this example we are going to use the <em>foreach</em> loop to tell the user is a store is currently open, or closed.</p>
<h3>Filling the Store</h3>
<p>To start, we are going to create a simple array of stores. We are going to name it stores.</p>
<p>When working with <em>foreach</em>, as well as arrays, I like to keep the names plural. It makes it easier to scan the code once you reach hundreds of lines.</p>
<pre name="code" class="php">

&lt;pre&gt;

&lt;?php

$stores = array('My Shoes','My Shirts','My Hats','My Pants');

?&gt;

&lt;/pre&gt;
</pre>
<p>We&#8217;ve wrapped our entire script in <em>&lt;pre&gt;</em> tags so that we don&#8217;t have to render out <em>&lt;p&gt;</em> tags to format our code. Instead we can just use /n to create a new line, but this will come in the next example.</p>
<p>Now that we have our stores array we can loop out the name of each store using our <em>foreach</em> loop.</p>
<p>In a nutshell the <em>foreach</em> loop is taking each array item (store name) and executing some code that we set. For each store we are going to show the user the name of the store.</p>
<pre name="code" class="php">
foreach($stores as $store){

echo "$store \n";

}
</pre>
<h3>What&#8217;s going on?</h3>
<p>We told PHP that <em>foreach</em> <em>$stores</em> item (our stores) we want to create a new variable of <em>$store</em> which holds the name of our store. Inside the <em>foreach</em> loop is the code that we want to execute for each store. In this example we are echoing out the value of <em>$store</em> which currently holds our store name. If you ran this script right now you should see something like:</p>
<p>My Shoes<br />
My Shirts<br />
My Hats<br />
My Pants</p>
<h3>Open 24/7</h3>
<p>Now we can make some quick changes to our array and <em>foreach</em> loop to tell the user if the store is open or closed.</p>
<pre name="code" class="php">
$stores = array(
'My Shoes' =&gt; 'Open',
'My Shirts' =&gt; 'Closed',
'My Hats' =&gt; 'Open',
'My Pants' =&gt; 'Open'
);
</pre>
<p>We&#8217;ve modified our <em>$stores</em> array and added a new key to each array item. All this is doing is saying <strong>My Shoes</strong> holds a value of <strong>Open</strong>. We can now make 2 changes to our <em>foreach</em> loop to reflect these changes.</p>
<pre name="code" class="php">
foreach($stores as $store => $status){

echo "$store is currently $status \n";

}
</pre>
<p><small>*Updated foreach loop. Thanks to Mark Skilbeck</small></p>
<p>We&#8217;ve added a <em>$status</em> variable to our <em>foreach</em> loop to pass our value of either Open or Close to the <em>$status</em> variable. We can now echo out the value of <em>$status</em> to display the current status of our store. Run the script and it should look like:</p>
<p>My Shoes is currently Open<br />
My Shirts is currently Closed<br />
My Hats is currently Open<br />
My Pants is currently Open</p>
<p><img class="alignnone size-full wp-image-237" title="final_example" src="http://envexlabs.com/wp-content/uploads/2009/11/final_example.gif" alt="final_example" width="550" height="139" /></p>
<p>To wrap everything up, the <em>foreach</em> loop takes our array (<em>$stores</em>) and shows the user the name (<em>$store</em>) and status (<em>$status</em>) of each store in<em> $stores</em>. This can be extremely useful when you have a large list of items that need to be shown to the user, or formatted in some way. The possibilities are endless!</p>
]]></content:encoded>
			<wfw:commentRss>http://envexlabs.com/2009/11/code-for-the-uncoded-foreach-loops/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP Shorthands: Write Less Code!</title>
		<link>http://envexlabs.com/2009/11/php-shorthands-write-less-code/</link>
		<comments>http://envexlabs.com/2009/11/php-shorthands-write-less-code/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 05:13:09 +0000</pubDate>
		<dc:creator>Matt Vickers</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://envexlabs.com/?p=218</guid>
		<description><![CDATA[Writing a lot of code can get very tedious especially when you are in hour 6 of your work day. I&#8217;m always looking for way to write less code so i&#8217;m going to share a few tips that I use on a daily basis. If/Else If Let&#8217;s say you are looping out some table rows [...]]]></description>
			<content:encoded><![CDATA[<p>Writing a lot of code can get very tedious especially when you are in hour 6 of your work day. I&#8217;m always looking for way to write less code so i&#8217;m going to share a few tips that I use on a daily basis.<span id="more-218"></span></p>
<h3>If/Else If</h3>
<p>Let&#8217;s say you are looping out some table rows and you want to make alternating rows different colors. Inside your while loop you&#8217;d be checking to see if a variable is even or odd.</p>
<pre name="code" class="php">
if($i % 2){

     $alt = 'even';

}else{

     $alt = 'odd';

}</pre>
<p>As you can see, that can be a lot of unnecessary code. Let&#8217;s shorten it up a little bit.</p>
<p>Using some short hands, we can reduce the 6 lines of code to 1 single line.</p>
<pre name="code" class="php">$alt = $i % 2 ? 'even' : 'odd';</pre>
<p>What just happened? First we are setting our variable of <em>$alt</em>. The next part we are setting a condition. If <em>$i</em> is divisible by 2, making it even, we are setting the value of alt to even, if not, we set the value to odd.</p>
<h3>Are You Talkin&#8217; To Me?</h3>
<p>The last quick tip is a shorthand for echo. Normally, an echo would look like:</p>
<pre name="code" class="php">&lt;?php echo 'Hey Guys'; ?&gt;</pre>
<p>If you have <em>short_open_tag</em> set to 1 in your php.ini you can use the example below. If you don&#8217;t have it included, you can include this one line of code to enable it.</p>
<pre name="code" class="php">//set short_open_tag to true to make sure your server allows shorthands

ini_set('short_open_tag', '1');

&lt;?= 'Hey Guys' ?&gt;</pre>
<p>Now, lots of people over the internet will either tell you this shorthand is the greatest thing since sliced bread, and the other will say it&#8217;s degraded and won&#8217;t be included in newer version of PHP. It&#8217;s basically all up to you.</p>
<p>Personally, I like to create a nice little function like the one below to take care of echoing out my text. It keeps it semi-future proof while cutting down on code writing!</p>
<pre name="code" class="php">
function e($a){

echo $a;

}</pre>
<p><small>*heavily inspired by the <a href="http://cakephp.org/" target="_blank">CakePHP</a> e() function. In fact it&#8217;s probably identical <img src='http://envexlabs.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </small></p>
<p><strong>UPDATE: November 5, 2009</strong></p>
<p>It seems that some user are a little bit confused about the <em>e()</em> function. Here is a quick usage example.</p>
<pre name="code" class="php">
//normal php echoing
&lt;?php echo 'Hey Guys'; ?&gt;
//returns Hey Guys

//shorthand on a shorthand enabled server
&lt;?= 'Hey Guys'; ?&gt;
//returns Hey Guys

//e() function
&lt;?php e('Hey Guys'); ?&gt;
//returns Hey Guys</pre>
<p>As you can see each example returns the exact same thing, but the amount of code required is a bit less with the final 2 examples. The upside to using the <em>e()</em> function is that we don&#8217;t have to write alot of code and it works on servers that don&#8217;t have shorthands enabled (which is good if you&#8217;re writing scripts for distribution).</p>
<p>Another pro to using the <em>e()</em> function is that you can also format the text before it&#8217;s echo&#8217;d out. This includes striping slashes or running regular expressions.</p>
<p>I hope you found this useful and as always, if you notice anything that needs changing or have improvements, please leave a comment and let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://envexlabs.com/2009/11/php-shorthands-write-less-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress as a CMS</title>
		<link>http://envexlabs.com/2009/10/wordpress-as-a-cms/</link>
		<comments>http://envexlabs.com/2009/10/wordpress-as-a-cms/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 14:34:28 +0000</pubDate>
		<dc:creator>Matt Vickers</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Screencasts]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[net tuts]]></category>
		<category><![CDATA[screencast]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://envexlabs.com/?p=214</guid>
		<description><![CDATA[When most people think about WordPress, they think about blogs. If you look at the front page of WordPress.org, they talk a lot about blogging as well. What they don&#8217;t tell you is that WordPress can also double as a very powerful CMS; you just have to set it up properly. It can be a [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-215" title="wordpress" src="http://envexlabs.com/wp-content/uploads/2009/10/wordpress.jpg" alt="wordpress" width="550" height="108" /></p>
<p>When most people think about WordPress, they think about blogs. If you look at the front page of WordPress.org, they talk a lot about blogging as well. What they don&#8217;t tell you is that WordPress can also double as a very powerful CMS; you just have to set it up properly. It can be a bit tricky to get setup and working the way that you want; but this is where I come in.<span id="more-214"></span></p>
<p>In this 3-part tutorial + screencast series, I&#8217;m going to take you through the three steps of using WordPress as a CMS.</p>
<p><a href="http://net.tutsplus.com/tutorials/plus-tutorials-2/wordpress-as-a-cms-new-plus-tutorial/" target="_blank">View the 3-Part Tutorial/Screencast</a></p>
<p><small>This tutorial is now owned by <a href="http://net.tutsplus.com/" target="_blank">NetTuts+</a>, I&#8217;m just the author.</small></p>
]]></content:encoded>
			<wfw:commentRss>http://envexlabs.com/2009/10/wordpress-as-a-cms/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How To Tame Your PHP Error Logs</title>
		<link>http://envexlabs.com/2009/10/how-to-tame-your-php-error-logs/</link>
		<comments>http://envexlabs.com/2009/10/how-to-tame-your-php-error-logs/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 03:00:23 +0000</pubDate>
		<dc:creator>Matt Vickers</dc:creator>
				<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[errors]]></category>
		<category><![CDATA[logs]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://envexlabs.com/?p=207</guid>
		<description><![CDATA[I recently watched a quick Screenr screencast by Jeffrey Way about logging your errors in PHP to a text file. Needless to say, I was a little bit inspired. It was only a quick 5 minute tutorial so it didn&#8217;t go into much detail and after implementing it into one of my projects it needed [...]]]></description>
			<content:encoded><![CDATA[<p>I recently watched a <a href="http://screenr.com/PON" target="_blank">quick Screenr screencast by Jeffrey Way</a> about logging your errors in PHP to a text file. Needless to say, I was a little bit inspired.</p>
<p>It was only a quick 5 minute tutorial so it didn&#8217;t go into much detail and after implementing it into one of my projects it needed some tweaking.</p>
<p>The main problem was there was the potential for your site to create thousands of indistinguishable error logs. My solution was to create folders to house daily log files. This makes your error logs live inside a nice folder structure broken down by year, month and day.<span id="more-207"></span></p>
<p>This was a quick script that I threw together so if you have any improvements please leave a comment and lets try and make this a bulletproof little function!</p>
<pre class="php" name="code">
//log any php errors to a folder on the server
function log_errors(){

	$log_folder = MAIN_PATH . '/_logs';
	$file = null;
	$current_folder = null;

	//we need to find out if a month folder has been created
	$year = date('Y');
	$month = date('m');
	$day = date('d');

	//set the current folder path to your/site/path/_logs/2009
	$current_folder = "$log_folder/$year";

	//create the year folder if it's not already created
	if(!is_dir($current_folder)){ mkdir($current_folder); }

	//month
	$current_folder .= "/$month";
	if(!is_dir($current_folder)){ mkdir($current_folder); }

	//day
	$current_folder .= "/$day";
	if(!is_dir($current_folder)){ mkdir($current_folder); }

	//set the file that we want to create
	$file = $current_folder . '/' . date('G:i:s') . '.txt';

	ini_set('display_errors', 1);
	ini_set('log_errors', 1);
	ini_set('error_log', $file);
	error_reporting(E_ALL);

}</pre>
<p>Be sure to <a href="http://jeffrey-way.com/" target="_blank">check out jeffrey&#8217;s site</a> for more interesting articles!</p>
<p><strong>UPDATE</strong>: Thanks to <a href="http://rcrisman.net" target="_blank">Ryan</a> for pointing out that we should switch to minutes with leading zeros<em> (i) </em>instead of using <em>(m)</em> which would check for the month <img src='http://envexlabs.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://envexlabs.com/2009/10/how-to-tame-your-php-error-logs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Ultimate Guide for Learning Mootools</title>
		<link>http://envexlabs.com/2009/10/the-ultimate-guide-for-learning-mootools/</link>
		<comments>http://envexlabs.com/2009/10/the-ultimate-guide-for-learning-mootools/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 21:45:55 +0000</pubDate>
		<dc:creator>Matt Vickers</dc:creator>
				<category><![CDATA[Screencasts]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[mootools]]></category>

		<guid isPermaLink="false">http://envexlabs.com/?p=180</guid>
		<description><![CDATA[Getting started with any type of framework can be an intimidating experience. I had worked with scriptaculous and prototype to begin with, but decided to move over to Mootools because it&#8217;s a more light weight framework. After the initial move to Mootools I was frustrated with the lack of community support and ended up moving [...]]]></description>
			<content:encoded><![CDATA[<p>Getting started with any type of framework can be an intimidating experience. I had worked with scriptaculous and prototype to begin with, but decided to move over to Mootools because it&#8217;s a more light weight framework.</p>
<p>After the initial move to Mootools I was frustrated with the lack of community support and ended up moving back to prototype immediately. After I was more comfortable with working with frameworks I moved back to Mootools and haven&#8217;t looked back.</p>
<p>With this tutorial, I&#8217;m going to try to make sure that you have a great beginning to the Mootools framework. I&#8217;m going to walk you through getting everything downloaded and setup as well as some of the basic elements of mootools. After that I&#8217;m going to spend some time walking you through how to use the Mootools Docs, which is a site that you&#8217;ll be visiting very often during the use of Mootools.</p>
<p><a href="http://net.tutsplus.com/articles/news/the-ultimate-guide-for-learning-mootools-new-plus-tutorial/" target="_blank">View the Tutorial/Screencast</a></p>
<p><small>This tutorial is now owned by <a href="http://net.tutsplus.com/" target="_blank">NetTuts+</a>, I&#8217;m just the author.</small></p>
]]></content:encoded>
			<wfw:commentRss>http://envexlabs.com/2009/10/the-ultimate-guide-for-learning-mootools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
