Browsing articles tagged with "php Archives - PHP Dev Tips"
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 […]

Jun
29
2014

WordPress Syntax Highlighters, and how to Switch From One to Another

If you’ve been to this site before,  you’ll probably notice that I’ve switched from the syntax highlighter that I’d used to display code to something a ton cleaner (the credit does not go to me, the new syntax highlighting plugin came from this TutsPlus article). Until a few hours ago, I used SyntaxHighlighter Evolved, which looked great, and was super easy to use, however, there were some issues with using it on a website displaying code that people […]

Jun
24
2014

Download Files with PHP (From a List)

Ever have one of those days where you get a new codebase on your desk, but realize that you’re missing ALL THE IMAGES?  (face slap). I’ve had plenty of those, and here’s how to stop slapping yourself and just use PHP to download files from a list in a text file! The Directory Structure Easy enough, but just to be safe, the following is the directory structure used for this: process.php attachment.txt files/ Process.php The […]

Jun
24
2014

PHP Error Reporting and Why You Should Care

If you’re a PHP developer, and you prefix questionable function calls with the “@” symbol, you should be aware that I’m onto you!  If the first line of code you write after <?php is “error_reporting(0);”, then we shouldn’t be friends anymore.  Error reporting in PHP is really really really important, and you should probably also stop reading, because this article will just fill your soul with rage. Keep in mind, this article isn’t about whether or […]

Jun
8
2013

Awesome Email open tracking with PHP and MySQL

Sometime last year, I wrote about super awesome email open tracking using PHP and MySQL, and I’ve since ALSO updated that one to be EVEN MORE SUPER AWESOME! Tracking email open rates is both very valuable, and very useful, particularly if you run a service where statistics are important, or in scenarios where more detailed information on users (namely their participation with site content outside the website is crucial). That being said, a couple things […]

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 […]

Oct
13
2011

Using PHP to merge and minify CSS and Javascript

And yet another ‘bangin’ update!  Don’t use this (I’m going to leave it here for reference), use the magicmin javascript and css minification/caching class instead for performance, better javascript minification, caching, gzip, base64_encoded images, and more! One MAJOR factor in the usability of your website is site load time.  This is affected by a number of factors: the number of images, database queries, and the number of server requests to fetch your stylesheets and javascript […]