Posts Tagged ‘David Walsh Blog

The following tools is in its very beta stages and works intermittently. Its so damn useful that I had to show it off now though!

I recently stumbled upon Downloadify, a client-side file generation tool based on javascript and Flash ActionScript code. A huge advantage to creating files on the client-side is that you can reduce the load on the server — especially when there’s no need for the server to get involved (the data is available within the page, etc.) Lets take a look at how we can use Downloadify.

Downloadify Usage

Downloadify.create('downloader',{
  filename: function(){
    return 'secret-message.txt'; //static file -- you could retrieve from form input box
  },
  data: function(){
    return 'MooTools FTW!'; //static content -- you could retrieve from form input box
  },
  onComplete: function(){
    alert('The file has been saved!');
  },
  onCancel: function(){
    alert('You have cancelled the saving of this file.');
  },
  onError: function(){
    alert('Error!  Damn!');
  },
  transparent: false,
  swf: 'media/downloadify.swf',
  downloadImage: 'images/download.png',
  width: 210,
  height: 55,
  transparent: true,
  append: false
});

Downloadify provides numerous options which you may pass per instance within the create method — this should look familiar to notice to advanced javascript users. What I really love about Downloadify is that it provides just the right amount of customization — events and filename/content settings. Too many javascript classes/functions try to do too much; Downloadify gets it right. My only criticism of Downloadify is it’s requirement of a 4-state sprite; it would be great if that were an option or the ActionScript could detect the height setting vs. the image file’s actual height and use the sprite if available.

MooTools Helper

/* mootools helper */
if(typeof(MooTools) != 'undefined'){
	Element.implement({
		downloadify: function(options) {
			options = $extend(Downloadify.defaultOptions,options);
			return this.store('Downloadify',Downloadify.create(this,options));
		}
	});
}

Downloadify comes with a jQuery helper but not a MooTools helper…I’ve remedied this.

Downloadify fills a need for many developers. Avoid unnecessary server load and jump on Downloadify!

Don’t forget to follow me on Twitter and be sure to visit Script & Style for the best Javascript and CSS articles around!

Sponsor the David Walsh Blog and get your brand in front of several thousand users per day!

Downloadify: Client-Side File Generation Using Javascript and Flash

Related posts:

  1. Basic File Uploading Using PHP
  2. Facebook Sliders With Mootools and CSS – Now With Image Generation!
  3. Create a Zip File Using PHP
  4. Basic PHP File Handling — Create, Open, Read, Write, Append, Close, and Delete
  5. WordPress’ .htaccess File Is Genius


Go to Source

MooTools Tabs

I’ve just released my third NetTuts post:  http://net.tutsplus.com/tutorials/javascript-ajax/sexy-animated-tabs-using-mootools/ .  From the post:

One modern, attractive way of placing a lot of content into a little space is by using a tab system. This tutorial will show you how to create a sexy, animated tab system complete with CSS sprites, cookies, and animated tab swapping.

Go over to NetTuts and check it out!

Don’t forget to follow me on Twitter and be sure to visit Script & Style for the best Javascript and CSS articles around!

Sponsor the David Walsh Blog and get your brand in front of several thousand users per day!

NetTuts: Sexy Animated Tabs Using MooTools

Related posts:

  1. David Walsh on NetTuts: Create a Twitter-Like “Load More” Widget
  2. NetTuts Exclusive: Twitter Emulation Using MooTools 1.2 and PHP
  3. Animated Progress Bars Using MooTools: dwProgressBar
  4. Eight7Teen Interview
  5. Sexy Opacity Animation with MooTools or jQuery


Go to Source

I was recently coding a website which relied heavily on query string variables. It was absolutely imperative that I keep the query string clean and not duplicate keys. I needed to find a PHP function that would allow me to remove keys (and their values) easily and reliably. Enter a PHP function I found at Added Bytes:

/* the function */
function remove_querystring_var($url, $key) {
	$url = preg_replace('/(.*)(?|&)' . $key . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&');
	$url = substr($url, 0, -1);
	return $url;
}

/* usage */
//pretending this page is

All I needed to do was provide the URL (in my case I wanted the current page’s URI) and the key to remove — so simple!

All credit goes to Added Bytes for their awesome work. It saved me a lot of time…hopefully it does for you too!

Don’t forget to follow me on Twitter and be sure to visit Script & Style for the best Javascript and CSS articles around!

Sponsor the David Walsh Blog and get your brand in front of several thousand users per day!

PHP Function: Remove a Query String Key=>Value

Related posts:

  1. Change the PHP Query String Variable Separator Using php.ini
  2. PHP Function To Get A File Extension From A String
  3. Generate Readable Byte Labels Using PHP
  4. PHP, Microsoft SQL Server (MSSQL), and IIS: Connect and Query with ODBC
  5. Remove Broken Images Using MooTools or jQuery


Go to Source


 Powered by Max Banner Ads 

About this blog

This blog delivers stylish and dynamic news for designers and web-developers on all subjects of design, ranging from: CSS, Ajax, Javascript, web design, graphics, typography, advertising & much more. Our goal is to help you communicate effectively on the web with an engaging website or functional interface.

New offer:


 Powered by Max Banner Ads 
Internet MegaMeeting, LLC Microsoft Store LinkShare  Referral  Program Iolo technologies, LLC Artisteer - Web Design Generator FTPress.com (Pearson Education) Mobile Security: Parental Controls and Monitoring Atom Entertainment (formerly AtomShockwave)
.
Web Analytics