Alternate Way to Write PHP Function Arguments Part 1: The Standard Process

When calling user-defined functions, there are occasions where it feels like optional arguments become required. I've seen third-party solutions like WordPress find a way to get around this issue. But it wasn't until recently that I've attempted my own solution. Before getting into an alternate method of passing function arguments, however, let's look at the standard process. [Continue reading]

Alternate Way for Adding Labels to Online Forms

To make HTML forms more accessible to those using assistive technology like screen readers, we need to use <label> tags to associate the field labels with the corresponding fields. It wasn't until recently that I realized you don't always need to add an id attribute to field that you're attaching the label to. There is another way and it requires less typing. [Continue reading]

Pasted Link No Longer Needed Once Facebook Pulls in the Automated Information

I just wanted to mention one more quick thing about posting links to Facebook. To get the automated information added to your post, you need to paste a link into the Status text box. Once Facebook recognizes the link and pulls in the corresponding page title, description, and images, did you know the link is no longer needed? [Continue reading]

Customize Link Information Pulled in by Facebook

While maintaining a company Facebook Page, it's common for me to add links within the company's posts. The nice thing about Facebook is that it automatically pulls information from the page you're linking to. It usually does a decent job of getting the page's title, description, and images. But when the information isn't quite right, did you know that it can be modified? [Continue reading]

Check Your Error 404 Database for Broken Links with cURL

Some websites that I maintain have a database for tracking which pages have moved. The problem is that some of the links that indicate where a page has moved to break. So I end up with a 404 error saying a page has moved. When the visitor goes to the new page, they are greeted with another 404 error saying the page has moved. So let's look into writing a script to look through the database for broken links. [Continue reading]

Help Visitors Find Moved Pages with a Simple Error 404 Database

Does your Error 404 page let visitors know where a page has moved to? Or does it have a generic message saying the page has moved and requires the visitor to find the page on their own? With a relatively simple database table and a few lines of code, we can enhance the error page and help customers find what they want faster. [Continue reading]

Disable Directory Indexes and Handle 403 Errors with .htaccess

The websites I develop for normally display the contents of a folder when an index file, like index.php, isn't present. This setup may work for some websites, but not the ones I work on. Instead of adding unnecessary index pages to prevent this type of activity, let's look at how the .htaccess file can help. [Continue reading]

Create Error 404 Page with .htaccess

How does your website handle missing pages? If a page ever gets renamed, moved to a different folder, or removed altogether; what do visitors of the old website address see? If they're greeted with a generic system message, there is a better way. Let's take a quick look at using .htaccess files and creating an Error 404 page to display a more user-friendly message. [Continue reading]

Duplicate Log Entries Caused by the AddThis Widget

A search engine I develop was showing some odd behavior a few weeks ago. While making a few back-end enhancements, I noticed that many of the log entries were being duplicated. And they weren't the typical duplicates caused by a programming error. These entries were being entered after a 20 to 30 minute delay. Plus, the duplicates originated from a completely different IP address. Well, it turns out that the AddThis code I installed on the website was the culprit. [Continue reading]

Remove Unnecessary Code by Rethinking Your Default Setting

Over the past few years, I've spent a lot of time revamping my old code. I've been doing what I can to simplify, simply, simplify. While going through the code, I started noticing a pattern when it came to setting defaults. Let's take a look at a quick example and see how I was able to remove the unnecessary code. [Continue reading]