Entries tagged "Web Development"

Generate Usernames with JavaScript: Working with Short Last Names

When generating usernames, one thing to consider is the length of the username. The code from last week's post may be problematic if you're looking for the username to be five characters or more and the user's last name is only two characters. After tacking on the first initial, you would only have three characters. So let's look at getting closer to the desired results. [Continue reading]

Using JavaScript to Dynamically Generate the Username within an HTML Form

Usernames are typically made up of some combination of the user's first and last name. If that's the case, the form used to create those usernames could be modified to take advantage of the data in the first and last name fields. Instead of making someone manually type the username, JavaScript could be employed to generate it automatically. [Continue reading]

Using Internet Explorer 9 to Test Websites with IE8 and IE7

Did you know that Internet Explorer 9 (IE9) provides the capability for viewing websites in IE8 and IE7? There's no need to install an add-on or download anything from a browser archive. The power to test websites using all three versions of Internet Explorer is built in. Of course, the feature for switching between the different options is a little buried. [Continue reading]

Choosing the Date Format in WordPress Themes: Let’s Give Control Back to the User

So many WordPress themes have the date format hard coded into the theme files. The problem is that some users will prefer to display the date in another way. Maybe the chosen format doesn't match their organization's style guidelines or maybe the format isn't grammatically correct. Changing a hard-coded date requires users to dig through file after file to modify every instance. Plus, if the theme developer releases an update, the user may need to do it all over again. To save users the hassle, why not let them decide how the dates are displayed. There is a setting in WordPress after all. [Continue reading]

Do Single-Quoted Strings Cause More Harm Than Good in PHP?

When writing PHP code, is it better to use single or double quotes? Using single quotes wherever possible will improve the performance of your code, but does it cost too much in productivity when less experienced developers work with the code? After all, certain things won't work as some might expect when using single quotes, such as variables inside the string. [Continue reading]

Using PHP’s implode() Function to Display an Array as a Value-Separated String

When displaying the contents of an array in PHP, what is your go to method? For example, if the items need to be displayed as a comma-separated or HTML unordered list, would you use a foreach() or for() loop? Utilizing a loop would accomplish the task. But there are other options. Why not give the implode() function a shot. [Continue reading]

Managing Website Contact Information with E-mail Aliases

E-mail addresses change. Employees retire, switch jobs, etc. With that in mind, why would you list addresses that are tied to specific people on an organization's website? If your Contact Us page says "For questions or assistance, contact Bob@yahoo.com, Mary@gmail.com, or Scott@mywebsite.com". What happens if Bob quits? It may only take a few seconds to update the page, but things could be easier with e-mail aliases. [Continue reading]

Slicing Strings with PHP: Be Mindful of Output that Contains HTML Tags

When experimenting with strings that contain HTML code, be mindful of what you're getting for output. Especially if there is something unexpected about the results. That's what I learned the hard way when extracting an open anchor tag from the source code of a web page. The variables used to locate the anchor tag appeared to be working, but for some reason the extracted code wouldn't display to the screen. Let's take a look at where I went wrong. [Continue reading]

Reducing the Number of Clicks When Saving Files Deep within a Website’s Structure by Using Shortcuts

When receiving lots of files via e-mail to convert to PDF and post on the website, it can be a time consuming project. Especially when the files are saved to a folder deep within a website and the software used to create the PDF doesn't remember the last folder you're saving to. Instead of clicking folder after folder for each file, let's look at folder shortcuts. [Continue reading]

Excluding Website Traffic Based on an IP Address in Google Analytics

Tracking the usage of your website can be very insightful. It helps identify which pages are the most popular, shows where your visitors are from, what browsers they use, etc. However, if you're visiting the website all the time to verify things are working, updating pages, etc. it can throw off the stats. So unless you're trying to pad the numbers, let's look at filtering out results by IP address in Google Analytics. [Continue reading]