Archive for the 'Code Bank' Category

Odds or Even in PHP

This is a quick and dirty method to get the infamous “Zebra Strips” on tables by assigning alternating classes.

For this example we’ll use the fmod() function in PHP…

Using Valid IE CSS Hacks

It’s important to remember that eventually IE will catch up to the times and we need to keep our hacks clean and ready for the future. At the moment, IE 6- seems to ignore decedent selectors so we can use that to our advantage when targeting a hack. We can use the child selector to replace both the old star html bug:

Ultimate Fade-In Slideshow (v1.51)

I just found this really great javascript slideshow generator at www.dynamicdrive.com. This can also be found at churchmedia.cc

PHP Lightweight device-detection

With the blaze of the iPhone and other similarly enabled "web" phones, companies such as Bank of America, ABC News, Flickr and Orbitz.com have made an extra effort to make their exceptional websites available across these smaller platforms.

Activating PHP5 in Godaddy Hosting

This is a quick and simple rewrite used to activate php5 and rename the handlers for php4. The following code will need to be in the root dir .htaccess file for global changes.

 

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

# switch GoDaddy's php extension handling for php5
AddHandler x-httpd-php5 .php
AddHandler x-httpd-php .php4

Quick way to getElementsByClass in HTML DOM

In this example I'll find all the elements with the class name "hideMe" and then hide/show them.

Valid XHTML Conditional Commenting

It's sometimes nessasary to write conditional commenting in (X)HTML or in CSS, especially with the current browser wars. Here, i describe how to write conditional commenting enabling/diabling IE from rendering. With some witty programming you can make IE/Win work in somewhat standards.

MOD_REWRITE tips and tricks

Before you begin to use mod_rewrite (RewriteRule, RewriteBase, and RewriteCond) code, keep in mind that each rule applied is executed on each and every HTTP request that accesses a file in or below the directory where the code resides.

The best way to support Transparent PNG in IE6

There are many way to support transparent .png images in IE browsers. However, this method seems the simplest and most “transparent to work with. It uses CSS compliant JavaScript .htc files and can be easily called thought the

behavior: url(iepngfix.htc);

How to implement:

Setting up .htaccess and .htpasswd (Godaddy Hosted)

A Simple approach for a password protect folder called /private

Open notepad and start typing… (When ready to save make sure the ext .txt is not there) 

File: .htaccess

AuthUserFile /home/content/u/s/e/username/html/private/.htpasswd

AuthGroupFile /dev/null
AuthName "Secure Directory"
AuthType Basic

<limit GET POST>
require valid-user
</limit>