Drupal 7 release party

January 7, 2011 Leave a comment
Categories: Drupal

Happy New Year 2011

January 1, 2011 Leave a comment

Categories: 1

Truncate text using php

March 19, 2010 2 comments
<?php
function truncate($string, $length='' , $k = ''){
	if( $length == '') $length = 50;
	if( $k == '') $k = '...';
    settype($string, 'string');
    settype($length, 'integer');
    for($a = 0; $a < $length AND $a < strlen($string); $a++){
        $output .= $string[$a];
    }
        if( strlen($string) > $length)
	   $output .= $k;
    return($output);
}
?>
truncate text using php
$my_string = 'I am kajal Mondol.I live in Kolkata.';
echo truncate($my_string);
echo truncate($my_string,10);
echo truncate($my_string,10,',,,');

This will output:

 I am kajal Mondol.I live in Kolkata.
 I am kajal... 
 I am kajal,,, 

This function truncates a variable to a character length, default is 50.
‘…’ is the default text to append if truncation occurs.
Second parameter determines how many characters to truncate to.

Drupal 6 Simple Views Slideshow Setup In Aquia Marina

March 17, 2010 Leave a comment
Categories: Drupal