Welcome to GandyXT!

846 Downloads and Counting!

Download

This version of CodeIgniter comes with the following packages installed:

Zipcode Library

$this->load->library('zipcode');

//20001 is Washington, DC
//36083 is Tuskegee, AL

$this->zipcode->get_distance(20001, 36083);
Distance between 20001 and 36083 is 662.4 miles

You must install the zipcode database table from here. The table name is "zip_code".

Wick Library

Paypal Library

Internal Additions

Assets Helper

External Additions

xajax

xajax is an open source PHP libary for building Web-based Ajax applications.

Controller


class Welcome extends Controller
{
	function Welcome()
	{
		parent::Controller();	
		$this->xajax->registerFunction(array('gimme_inflection',&$this,'gimme_inflection'));
		$this->xajax->processRequest();	
	}
	
	function index()
	{
		$view['xajax_js'] = $this->xajax->getjavascript('assets/js/');
		$this->load->view('welcome_message', $view);
	}
	
	function gimme_inflection($data, $what)
	{
		$this->load->library('form_validation');
		$this->load->helper('inflector');
		//new xajax response object
		$response = new xajaxResponse();
		
		$this->form_validation->set_rules('value', 'Your word', 'required|min_length[3]');
		foreach($data as $id => $field)
		{
			$_POST[$id] = $field;
		}

		$word = $data['value'];
		$$what = $what($word); // either $plural or $singular
		if ($this->form_validation->run())
		{
			if($what == 'singular')
			{
				$opposite = 'plural';
			}
	
			if($what == 'plural')
			{
				$opposite = 'singular';
			}
			
			//Assign the value to a div
			$response->Assign($what . '-span', 'innerHTML', $$what);
			$response->Assign($opposite . '-span', 'innerHTML', '');
			$response->Assign('value', 'value', $$what);
		}
		else
		{
			$this->form_validation->set_error_delimiters('', '');
			$response->Alert(form_error('value'));
		}
		
		//returns the response
		return $response;
	}
}

View

<form name="inflection">
    <p>Enter a word:</p>
    <input id="value" name="value" />
    <input type="button" onclick="xajax_gimme_inflection(xajax.getFormValues('inflection'), 'plural');" value="Plural!" />
    <input type="button" onclick="xajax_gimme_inflection(xajax.getFormValues('inflection'), 'singular');" value="Singular!"/>
</form>

<h4>Singular: <span id="singular-span"></span></h4>\
<h4>Plural: <span id="plural-span"></span></h4>

Enter a word:

Singular:

Plural:

***********************************

facebox

Facebox is a lightweight Facebook-style lightbox which can display images, divs, or entire remote pages (via Ajax) inline on the page and on demand. It uses the compact jQuery library as its engine, unlike Lightbox v2.0, which uses Prototype.

View "sample.htm" fetched via Ajax

<p><a href="sample.htm"  rel="facebox">View "sample.htm" fetched via Ajax</a></p>

***********************************

lightbox

Lightbox is an elegant, unobtrusive script that overlays a larger version of an image on the current page for display when clicked on- an image thumbnail viewer if you will. It's a snap to setup and works on all modern browsers.

Sample Image

<?php echo img_src('gallery/1.png'); rel="lightbox" title="sample image desc">Sample Image</a>
or
<?php echo img_src('gallery/1.png'); rel="lightbox[group1]" title="sample image desc">Sample Image</a>

You will have to edit assets/js/lightbox.js to give the proper location of closelabel.gif and loading.gif

Facelift

Facelift replaces text with an image representation of that text styled with your custom font. And since the text is retrieved directly from the page, you don't have to worry about updating any images when text changes — it is all done automatically!
http://facelift.mawhorter.net/

Examples:

<style>
h3.red {
	color:#FF0000;
	font-weight:bold;
	font-size:18px;
}

h3.big-purple {
	color:#663399;
	font-size:24px;
}
</style>

<script language="javascript" src="http://www.gandylabs.com/assets/css/facelift/flir.js">
<script type="text/javascript">
FLIR.init( { path: 'http://www.gandylabs.com/assets/css/facelift/' } );
FLIR.auto([ 'h1', 'h2', 'h3.red', 'h3.big-purple']); 
</script>

This is h3.red

This is h3.big-purple

Cheat Sheets