Entries tagged "PHP"

Lessons Learned: Automated Script for Populating Meeting Handouts Database

A few years back, I developed a script for processing sets of PDFs to populate a database. That database is then used to dynamically generate the corresponding meeting handouts page for visitors to download the PDFs. The project was planned out so that pretty much everything needed for the meeting handouts page could be found in the set of PDFs. The only other extra thing I needed to do, besides making occasional minor corrections to the database, was store these handouts in a folder that was named with the meeting date, which I was already doing. Then I just needed to upload the files to the server and run the script. [Continue reading]

Add Delay Feature to Newsfeed

The newsfeed feature I developed a few years back works as expected. At times, however, I wish it would let me have a post automatically appear after a specific time. Especially now that I'm used to services like HootSuite that allow me to schedule tweets and other social media postings. [Continue reading]

Use MySQL’s Date Functions Instead of PHP’s

Many of the MySQL queries that I create include a date and / or time. My usual place to get this information was from PHP's date() function. At least until I discovered that MySQL has many built-in functions to do the same thing. Let's look at a quick example. [Continue reading]

Import Login Information for Database Connection Scripts

I'm starting to realize that importing the script used to establish a database connections isn't enough. Being able to import a script wherever the database is needed does simplify the process of changing a database password since it only needs to be changed in one place. However, I keep finding reasons to make major revisions to the connection script which usually results in having multiple versions and I don't always have the time to complete the upgrade process. All of those connection scripts need to be updated when the password changes. [Continue reading]

Calculate Distance Between Zip Codes Part 2: Build the Search Engine

With a database full of zip codes, latitudes, and longitudes, you can get all the entries that are within a given radius using the Haversine formula…and a little help from Google. This week's post will build on the work done last time by developing a search engine where users can enter a zip code and a search radius. The script will then output all the records within the given radius. [Continue reading]

Calculate Distance Between Zip Codes Part 1: Geocode Database Entries with the Google Maps API

A few years back I looked into using the Google Maps API to calculate the distance between two zip codes. The proof of concept seemed to work well enough. But when I attempted to perform larger-scale calculations, the solution began falling apart. And it was slow… So I needed to develop an alternative solution. [Continue reading]

How to Test Submissions from Forms that Use the POST Method

An important part of developing online forms is testing. One area of testing I've always wanted to better with is making sure input types like radio buttons can't accept values which are not allowed. In this week's post, we go over my primary method of testing. That way we can discuss a faster way next time. [Continue reading]

Lessons Learned: Outputting Shortcode and Plugin Results

If you look closely at the documentation for WordPress Shortcodes, there is a specific way to output content to the screen. Of course, this is a part of the documentation I skipped while developing my first plugin which lead to some baffling results. To help save you time, I wanted to share one last lesson learned from writing my plugin. [Continue reading]

Lessons Learned: How Not to Name Shortcode Attributes in WordPress

Developing my first WordPress plugin provided me with many learning opportunities. We already talked about the quicker way of uploading plugin files. In this post, I wanted to share the problem I had with shortcode arguments. Hopefully it will help you avoid the same issue. [Continue reading]

My First WordPress Plugin: Generates a Bulleted List of Clickable Blog Post Titles

I recently helped with a redesign that involved building a website with an out-of-the-box WordPress theme. The theme met our needs for the most part, but we were looking for something to dynamically generate an FAQ page from blog posts tagged with "FAQ". After trying some third-party plugins which didn't quite work for us and attempting to modify the theme files directly, I decided it was time to build my first WordPress plugin. [Continue reading]