MooTools Archives

Build HTML Tables From MySQL Tables with PHP

Published by David Walsh on Wednesday, July 21, 201011 Comments

I was recently completing a project which required that I build a series of HTML tables which would represent all of the tables within a MySQL database.  I didn’t have anything created but after a few minutes I had exactly what I needed. Hopefully this helps you out!

The CSS

table.db-table 		{ border-right:1px solid #ccc; border-bottom:1px solid #ccc; }
table.db-table th	{ background:#eee; padding:5px; border-left:1px solid #ccc; border-top:1px solid #ccc; }
table.db-table td	{ padding:5px; border-left:1px solid #ccc; border-top:1px solid #ccc; }

The CSS I’m styling the table with is as basic as it gets — style as you wish!

ServerSide JavaScript with MooTools and NodeJS

Published by David Walsh on Monday, July 12, 20109 Comments

MooTools and NodeJS

This post was authored by Christoph Pojer. To learn more about Christoph, click here.

This blog post is intended to provide a starting point for ServerSide JavaScript (SSJS) development with MooTools. It is focused on NodeJS (http://nodejs.org) and tries to explain the main concepts and differences from client side development. It is solely based on my current experience, my current work, and the best practices I have defined for myself so far – though most of this has been heavily influenced by people from other people of the MooTools team.

How to Setup NodeJS

MooTools Equal Heights Plugin: Equalizer

Published by David Walsh on Thursday, June 24, 201011 Comments

Keeping equal heights between elements within the same container can be hugely important for the sake of a pretty page. Unfortunately sometimes keeping columns the same height can’t be done with CSS — you need a little help from your JavaScript friends. Well…now you’re in luck.

MooTools Class Sniffer Bookmarklet

Published by David Walsh on Monday, June 21, 20103 Comments

I was recently reviewing a few MooTools-driven websites and one of the questions I wrote down was “Which MooTools Core classes do you use and how many classes have you created?” Then I asked myself if there was a way I could figure that out myself. The end result is a JavaScript bookmarklet that finds all of the MooTools classes defined within the Window object.

New MooTools Methods: .from()

Published by David Walsh on Monday, June 21, 20101 Comment

MooTools 1.3 beta 2 was recently released and you may see a few new methods implemented to String, Array, Number, and Function: from. The from method of each of those Types returns an object of that type. Simply put: you’ll always receive back an object of that type based on what you give it.

The New Method Code

Function.from = function(item){
	return (typeOf(item) == 'function') ? item : function(){
		return item;
	};
};

Array.from = function(item){
	if (item == null) return [];
	return (Type.isEnumerable(item) && typeof item != 'string') ? (typeOf(item) == 'array') ? item : Array.prototype.slice.call(item) : [item];
};

Number.from = function(item){
	var number = parseFloat(item);
	return isFinite(number) ? number : null;
};

String.from = function(item){
	return item + '';
};

The from method is added to String, Array, Number, and Function natives. Enough with the underlying code though — examples are easier to understand.





© David Walsh 2007-2010. Contact David Walsh. Powered by the remarkable MooTools JavaScript framework.