Browsing articles in "Classes and functions"
Jul
11
2014

Templated HTML Email with PHP using PHPMailer

Today we’re going to talk about sending amazing, templated, parsed HTML emails using PHP and the PHPMailer class. I know it sounds trivial- “Oh sure! Let’s send some messages!”, however, I do get a ton of requests for assistance when dealing with email templates and parsed content within those templates, so I figured this would be a good thing to write about! Background When I refer to email templates, I’m referring specifically to chunked, individual […]

Jul
8
2014

MagicMin Version 3 Available!

Minifying CSS and Javascript just got way more awesome with MagicMin 3.0.0! Along with better directory path support for windows machines, V3 includes the ability to output merged/minified files with unique hashed filenames for better caching support

Jun
22
2013

Retrieving Facebook Open Graph Data with PHP

Ever wonder, “Huh, I have a company page on facebook, but DAMN it’s lame to have to login to se the stats”?  I did, and as always- let’s grab some data with PHP! CODE! At the core of nearly anything you want to do with the facebook open graph is this url: https://graph.facebook.com/(username or id) And really, this doesn’t get a whole lot longer for the basics, we just need to use file_get_contents and json_decode […]

Jun
20
2013

Javascript and CSS Minification Class- MagicMin

A long long time ago, I wrote about using PHP to merge and minify javascript and CSS.  And it sucked!  It forcefully recreated the files each and every time the page was loaded, failed to compress or minify javascript files properly (resulting in some super duper errors), and overall was lame. It was however, short, so at least it had that going for it, which my actually awesome new class “MagicMin” does not have (it […]

Jun
7
2013

Updated MySQLi Database Class

Since I posted my mysqli database class originally on February 18th, I’ve gotten some great feedback, and A LOT of downloads, which is amazing! As a side note, I recommend always grabbing this class from the github repo at https://github.com/bennettstone/simple-mysqli I’ve also been using my own class on a large number of websites, and through the course of normal usage, and user feedback, I have made some changes… The error reporting has been enhanced to […]

May
20
2013

Simple session based “flash” messages

Quite a while ago, I grew tired of trying to come up with new and creative ways to display simple, one-time messages to users without crazy amounts of code for something that was frequently as trivial as “Saved!”. Sessions are the obvious solution, however, without a single function that could both generate, AND display the messages, it still wasn’t any better.  And as usual, where there’s a will, and some code- there’s a way! Before […]

Feb
18
2013

Custom PHP MySQLi Database Class

Updated class files (documentation remains the same) with better error handling and full OOP class structure can be found here. Since the depreciation of the mysql functions in PHP (archive here), I thought it may be handy to more effectively future-proof my web applications by wrapping my database interactivity functions in a class (and oh how it is!), and as I was building a new web framework anyway- I figured why not! Unrelated: featured image […]

Feb
4
2013

Using PHP to output images (AWESOME STYLE)

Don’t get me wrong, I’m not lazy, but I’m also NOT a front end designer or HTML guru. So when it comes to repeating tasks endlessly that are even mildly lengthy- I get bored. That’s right, I said it- b.o.r.e.d. Tonight was a perfect example! As a back end engineer, I’m nearly always provided very tidy, but elaborate HTML assets, which are then on my desk to become amazing and highly functional beings. But after […]