A Web Development Blog Focused on Code and Technology
Currently Browsing: Home
The fade effect, as its name denotes, is an animation used to fade an element off of a page. You can find a demo of it in the jQuery documentation.
PHP and MySQL have often been known as two peas in a pod. Unfortunately, when you use PHP to insert information into a MySQL database, you often have to write large queries that take up much of your time. Not only that, but you also have to clean user input. This quick tip aims to streamline your efficiency by writing a simple function to do this job for you.
Write helper functions
Before we start working on the main program, we first need to create two helper functions which will be used later on:
By Patrick Lin on Monday, December 27th, 2010 | No Comments »
Take a look at this image in Firefox or Opera. Now view it again in any other browser. Notice a difference?
In case you don’t have multiple browsers, here’s a screenshot of a side-by-side comparison of Firefox and Safari:
So how is it possible that this PNG file can magically detect what browser you’re using? Read on to find out.
If you use WordPress, you know that after a few months of blogging, there are far too many posts to display simultaneously. To reduce the loading time of your website, you could consider a pagination system, in which you display only a certain number of posts per page. By giving the user the ability to navigate through pages, your posts will all be available and left intact.
Unfortunately, changing the posts per page option under your WordPress reading settings does not automatically create pagination; rather, you have two options:
- Use WordPress’ in-built functions (
next_posts_link) to allow the user to navigate between pages.
- Create your own pagination system.
The main problem with the first option is that WordPress only allows the user to go to the next or previous page; there is no way to jump a set of pages without having to visit everything in-between. Consequently, the bottleneck is in the user-experience.
With the second option, the burden is on the developer. Even though it requires more coding, the user experience is not compromised. As a result, today’s article will focus on how to write your own custom WordPress pagination system. To view a demo, see Lateral Code’s pagination.
If you have ever administered a website, you know that downtime is unavoidable. Creating a system to automatically check if your website is up can help deal with downtime and provide a better user experience. Doing so is quite simple if you have the following tools available:
- A web server other that that on which the website is hosted
- Cron (if you do not have this, you can use an online service)
- PHP with libcurl support
- PHP with mail support (optional)