0
I Use This!
Activity Not Available

Project Summary

Cut html string by keeping html tags as it isWith 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 stringFor more information check http://pypi.python.org/pypi/htmlcutstring/1.0
Using PHP codeDownload php-cut-html-string.tar.gz/.zip file and extract it. Include the cutstring.php file and use like this

$data = "aaBBonetwothree";
$wanted_count = 10;
$cutstrObj = new HtmlCutString($data,$wanted_count);
$new_string = $cutstrObj->cut();
echo $new_string;
// output aaBB\none\ntwo\nNow we can directly use the cut_html_string function

$data = "aaBBonetwothree";
$wanted_count = 10;
$new_string = cut_html_string($data,$wanted_count);
echo $new_string;
// output aaBB\none\ntwo\nThe above code examples will output aaBB\none\ntwo\n. Here after finising the li content two the 10 characters are finished so the output did not included the next li tag and output is still closing ul and span tags. The tag attributes style is kept as it is in the output also.

Using Javascript codeDownload javascript-cut-html-string.tar.gz/.zip file and extract it. Include the cutstring.js file in your html file and use like this.

var data = 'aaBBTest Cutstring bb';
var wanted_count = 10;
var cutstrObj = new CutString(data,wanted_count);
var newStr = cutstrObj.cut();
alert(newStr);
// alerts aaBBTest CNow we can directly use the cut_html_string function

var data = 'aaBBTest Cutstring bb';
var wanted_count = 10;
var output = cutHtmlString(data, wanted_count);
alert(output);
// alerts aaBBTest CThe above examples will output aaBBTest C. Here after charcter "C" in b tag the 10 characters are over so b tag is just having 'C' and span tag is closed properly

For more examples check the test files in the code.

Tags

cuthtmlstring

In a Nutshell, cut-html-string...

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

GNU General Public License v3.0 or later
Permitted

Place Warranty

Use Patent Claims

Commercial Use

Modify

Distribute

Forbidden

Sub-License

Hold Liable

Required

Distribute Original

Disclose Source

Include Copyright

State Changes

Include License

Include Install Instructions

These details are provided for information only. No information here is legal advice and should not be used as such.

All Licenses

This Project has No vulnerabilities Reported Against it

Did You Know...

  • ...
    Black Duck offers a free trial so you can discover if there are open source vulnerabilities in your code
  • ...
    compare projects before you chose one to use
  • ...
    55% of companies leverage OSS for production infrastructure
  • ...
    data presented on the Open Hub is available through our API

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

Community Rating

Be the first to rate this project
Click to add your rating
   Spinner
Review this Project!
Sample ohloh analysis