Cut html string by keeping html tags as it is
With the use of WYSIWYG editor user can enter html content. While displaying teaser(short content) of the content on home page or dashboard it is hard to cut the string properly. This project provide solutions in php, javascript languages.
Added Python Implementation of cut html string
For more information check http://pypi.python.org/pypi/htmlcutstring/1.0
Using PHP code
Download php-cut-html-string.tar.gz/.zip file and extract it. Include the cutstring.php file and use like this
$data = "
aaBB";$wanted_count = 10; $cutstrObj = new HtmlCutString($data,$wanted_count);$new_string = $cutstrObj->cut();echo $new_string;// output
aaBB<