Coda Clips

PHP usage in JavaScript

<script type="text/javascript">
<?php $count=0; ?>
for(var i=0;i<10;i++)
{
   <?php echo "Value of Counter".$count;?>
   <?php count++; ?>
}
</script>

Added to by Srikanth Rayabhagi

Install Clip


str_split function for PHP 4

function str_split($str) {
	$str_array=array();
	$len=strlen($str);
	for($i=0; $i<$len; $i++) {
		$str_array[]=$str{$i};
	}
	return $str_array;
}

Added to by Ben Palmer

Install Clip


Get Gravatar Pic

<?php
  $gravatar_link = 'http://www.gravatar.com/avatar/' . md5(<<**SelectionInsertionPlaceholder**>>) . '?s=32';
   echo '<img src="' . $gravatar_link . '" />';
?>

Added to by Johan

Install Clip


Php Multi Line Assignment

$<<**SelectionInsertionPlaceholder**>> = <<<TEXT
Row 1
Row 2
TEXT;

Added to by Cipa

Install Clip


CI Controller

<?php
class <<**SelectionInsertionPlaceholder**>> extends Controller {
	function <<**SelectionInsertionPlaceholder**>>() {
		parent::Controller();
		$this->load->model('<<**SelectionInsertionPlaceholder**>>s');  // Load Model
	}
	function index() {
		$data['title'] = '<<**SelectionInsertionPlaceholder**>>';
		$data['heading'] = '<<**SelectionInsertionPlaceholder**>> List';
		$data['query'] = $this-><<**SelectionInsertionPlaceholder**>>->get();
		$this->load->view('<<**SelectionInsertionPlaceholder**>>_list', $data);
	}
}
?>

Added to by John Huh

Install Clip


require once php file

require_once('<<**SelectionInsertionPlaceholder**>>.php');

Added to by ndub

Install Clip


include_once php file

include_once('<<**SelectionInsertionPlaceholder**>>.php');

Added to by ndub

Install Clip


include php file

include('<<**SelectionInsertionPlaceholder**>>.php');

Added to by ndub

Install Clip


Sponsored Links: