Web development , php , ajax , symfony, framework, zend
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.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 */
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:
In: web resources
19 Jan 2010I’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:
In: web resources
18 Jan 2010I 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:
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.



