in the mail.php i can use the $Customer_First_Name like a normal php variable… the rest can be simple html. I dont see the point of making it more difficult than it has to be. $msg contains your template, use it if you like to send it in an email or show it on the site.

]]>By: Timothy Boronczykhttp://www.sitepoint.com/5-inspiring-and-useful-php-snippets/#comment-17760
Fri, 06 Jul 2012 01:29:42 +0000http://www.sitepoint.com/?p=3023#comment-17760Your approach would overwrrite the entire vars list that way, but it could be a perfectly acceptable approach depending on your needs. My set() example looks at the nature of the parameters passed to it to provide a jQuery-esque streamlined API and iterates through arrays pushing them onto the internal vars list.
]]>By: Trevor Geenehttp://www.sitepoint.com/5-inspiring-and-useful-php-snippets/#comment-17759
Thu, 05 Jul 2012 17:37:00 +0000http://www.sitepoint.com/?p=3023#comment-17759I really like the class auto load script that you put in the article. It is clean and simple, something I love in code.
]]>By: Webtrendzshttp://www.sitepoint.com/5-inspiring-and-useful-php-snippets/#comment-17758
Thu, 05 Jul 2012 06:58:11 +0000http://www.sitepoint.com/?p=3023#comment-17758Nice info there Tim. However,with templating html i wouldn’t want to do the set() function the way you did. You already have the var property which is suppose to contain the template variables and the __set() magic function to set the variables. This would do: function set($arrData){ $this->vars=$arrData;}. You don’t need to call the setter function again inside the set(), that will be a work overload to the class. Remember the __set() function the way it works: if i have $arrData=array(‘right’=>’put me right here’) and i call $this->right in my template, the class attempts to read the property but does not find so it calls the __set() method to set it whic reads from the $this->vars and gets the right value that you just paased in the array $arrData
]]>By: Dave Hulberthttp://www.sitepoint.com/5-inspiring-and-useful-php-snippets/#comment-17757
Mon, 02 Jul 2012 12:48:06 +0000http://www.sitepoint.com/?p=3023#comment-17757I’d wrap the include_once in the spl_autoload_register in an is_readable() check, so it can be used with other autoloaders.
]]>By: Alex Gervasiohttp://www.sitepoint.com/5-inspiring-and-useful-php-snippets/#comment-17756
Mon, 02 Jul 2012 00:05:41 +0000http://www.sitepoint.com/?p=3023#comment-17756Nice compilation of snippets indeed. Not only they do show how to accomplish what they promise at face value, but they do it through solid code. Well done Tim :)
]]>By: Timothy Boronczykhttp://www.sitepoint.com/5-inspiring-and-useful-php-snippets/#comment-17755
Sun, 01 Jul 2012 23:05:36 +0000http://www.sitepoint.com/?p=3023#comment-17755Perhaps in hindsight I should have explained them, sorry. php://output opens a connection to PHP’s output buffer. php://temp/maxmemory is a connection to chunk of memory, and if too much is written to the memory it will fallback to a physical temp file. They’re documented in the PHP Manual. But on the bright side, you were able to learn something that you didn’t know before!
]]>By: CodeAngryhttp://www.sitepoint.com/5-inspiring-and-useful-php-snippets/#comment-17754
Sun, 01 Jul 2012 20:12:46 +0000http://www.sitepoint.com/?p=3023#comment-17754When I saw the first CSV snippet… (facepalm). When I saw the second one, I sighed with relief :)

I don’t usually comment like this but good snippets and clean code. I like that!