Archive for the ‘Miscellaneous’ Category

How to include jQuery dynamically, aka, check to see if it exists

I cannot tell you how many times I’ve walked into a project that required the following:

  1. Fancy JavaScript alerts, dialogs, and validation.
  2. JavaScript assets that will distributed to subsites / satellite sites.
  3. Of these sites, some may or may not already have these assets already defined.

What I’m referring to specifically is jQuery. While building a tasty and user-friendly form.. I needed a way to check to see if jQuery didn’t exist, and if it didn’t include it dynamically by append it to the HEAD tag. This is commonly referred to ‘including jQuery dynamically’. Often times different phrases such as ‘check to see if jQuery is defined’, ‘lazy load jQuery’, ‘!window.jQuery’

Here is the JavaScript code to make the magic happen.

if(!(window.jQuery && window.jQuery.fn.jquery == '1.3.2')) {var s = document.createElement('script');s.setAttribute('src', 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js');s.setAttribute('type', 'text/javascript');document.getElementsByTagName('head')[0].appendChild(s);}

As a recap, here is what the snippet above does. “Check to see if jQuery is defined. If it’s not, grab jQuery from Google’s API and include it in the HEAD tag”.

XZero Classifieds – jQuery Expanding Country List

XZero Scripts has released a great tool for developer looking for a classified script – XZero Community Classifieds.

With an strong and eager community helping to further the development of the script, many people have taken the liberty to release their own mods. One modification we thought would be awesome to give back to the community is the expanding drop-down city list in the right side bar. Interested? Great!

You’re probably asking yourself “what’s the catch”? Truth be told, just a simple 1 file replacement. Follow these steps:

–> Download ‘cities.inc.zip’

Installation

  1. Open ‘cities.inc.zip’ and extract the file ‘cities.inc.php’ to your computer / desktop.
  2. Open your favorite FTP program and upload ‘cities.inc.php’ to the root of your XZero Classifieds installation. This WILL replace the old ‘cities.inc.php’ that came packaged with your original installation.

That’s it!

Enjoy!

Developer Notes

The drop down uses the jQuery framework for its animations. The framework is being remotely downloaded using Google’s JavaScript API script (jsapi).

Download Free jQuery Cities Drop down Mod for XZero Classifieds (1.51kb)
Downloaded 275 times.

Is Content the King Still? (Who’s Taking His Place)

Since the very first blog, written around an ancient campfire somewhere in the moist foothills of Seattle, content has been crowned the undisputed king for ages.

The king ruled over all that was written, be they blogs, articles, ads, fiction, or a killer love letter. All that was copy sat at the feet of the king.

Nothing succeeded without content. Writing without it was cast from the kingdom, banished as self-serving junk mail and the much-loathed “interruption marketing.” Read the rest of this entry »

Setup Gmail with Outlook 2003, Outlook 2007 and Outlook Express

Google Mail, the beloved backbone of many small business email communications. Gmail is seen as more professional than your average ‘@yahoo.com’ and ‘@aol.com’, but it shares the same favored monthly fee, free. One service Yahoo! does not offer for free is POP while Gmail does. POP does not mean anything to you other than a fancy name for soda? Click the “What’s POP?” tab below. This article will describe and provide picture perfect, simple screenshots for configuring Outlook 2003, Outlook 2007 and Outlook Express to download and view your Gmail emails from your computer. Let’s face it, words just aren’t as simple as pictures. Read the rest of this entry »

Favicon – Do It Yourself, The Right Way

Don’t you love it when you’re browsing the internet and all of a sudden you come across the most slick website imaginable… and the one thing that stands out above everything is a kickass favicon?

What’s a favicon you ask? Click the “Faviwhat?” tab below.

The creation:

You have a snazzy logo and want the icon next to the URL bar to match it. How you ask? Sit back, read, enjoy the ride. Oh, and I’ll throw in a couple snapshots too.

In this example, I’ll be using a quickly created logo for demonstrative purposes.

nukleeur

Open the image in Photoshop and select the crop tool.

crop1

Then, type “16px” in both the height and width fields in the top part of the screen. This will allow whatever you select with the crop tool in the next step, to automatically be adjusted and resized to 16×16. The reason why it’s 16×16 is because that is the standard Favicon size most widely accepted by all browsers.

crop2

Select the following area, this EXACT area will be your favicon upon accepting the changes.
Note: Make sure that at the top of your screen you have the ‘delete’ radio button clicked, and that after selecting the area you click the ‘Approve’ check mark on the top right part of Photoshop.

crop3

Now, export it into a web readable format. This is the important part. All favicon’s use a bit depth of 32 colors. Aka, if your cropped image has 60 colors, it’ll actually REMOVE any of those extra colors creating an undesirable effect. Let’s use a promised result by first clicking “Save for Web and Devices” or ALT+CTR+SHIFT+S for short.

crop4

Now, use the following settings and save the file as “favicon.gif”. After you have it saved, rename it to “favicon.ico” and that’s it! You officially created your own favicon using Photoshop from a logo. Not so bad, is it? What do you do with it you ask? Click the “Show it off!” tab above to see and grab the snippets of code that make this shining piece of work display next to the site’s URL.

The snippet, the problem, and the solution

So, we’ve got the icon, but what do we do with it? We insert it into the header of our HTML page.

First, using your favorite FTP Client (we recommend FileZilla) to upload the favicon to the ROOT of your site. Generally, this is the same place as your index.html is stored.

After the icon has been uploaded, we can now tell the webpage that when loaded, to look for this icon and display it in the browser. To do this, we need a snippet of code.

1
<link rel="shortcut icon" href="/favicon.ico" />

What this does is allows the browser to say “Find this particular file starting at the root of the site, check its bit depth… and if all is well.. set this image to be the shortcut and default URL icon for the site”.

Add the snippet above inside the HEAD tag and your site will now use the Favorite Icon (Favicon).

I did all that, why is it not showing?

One answer. Cache.

Most browsers (like FireFox) stores a website’s data, icons, etc in a caching system. When revisiting that site during the current session state it will try to use as many previous resources as possible. This includes CSS, JavaScript.. and as you guessed it.. images. Since your Favicon is indeed an image and your site didn’t have an image about ten minutes ago, it used a blank clear one instead and stored it for later use.

In order to see the updated version go to “Tools -> Clear Private Data” and ONLY check the “Cache” and “Offline Website Data” checkboxes. Then clear it and close FireFox. If it asks you to restore your previous session, start a new one.

Viola!

Enjoy adding that final touch to your already amazing website.

→ Download Source / Examples ←

Source ZIP Includes:

  • Nukleeur Logo
  • Favicon
  • HTML file with Favicon Snippet

What exactly is a Favicon and why don’t I have one already?

Favicon stands for “Favorites Icon”. It’s the little icon beside your site’s name in the favorites list, before the URL in the address bar, as a bookmarked website on the desktop, in the “Links” bar and on the windows taskbar.

If you don’t have one, this is because you have not specified in the HEAD element of your HTML pages to look for a favicon.

Still scratching at your head?

Here is Google’s favicon.

crop5

Page 1 of 11

Latest Posts

JomSocial Popup Dialog Ajax Won’t Finish Loading

March 25th, 2010 by Tim Selaty

JomSocial is a great extension built for the wonderful Joomla! that comes with many features people desire in (more…)

United we Stand for Americans

February 18th, 2010 by Tim Selaty

The Idea: To create a web presence that is consistent and relays the idea of “conservative values” to (more…)

SellerBuzz

February 17th, 2010 by Tim Selaty

Seller Buzz is for Online Sellers just starting out in the world of eCommerce. Seller Buzz is also (more…)

Timberhawk

February 17th, 2010 by Tim Selaty

At Timberhawk we use high-tech equipment and software to produce a stronger, more accurate and faster built home. (more…)