Documentation

HTMLToTxt

string
HTMLToTxt( string text,
string host = "",
array delete = array(), string maxlen=70
);

The function converts the original HTML code to plain text by deleting tags or replacing them with the equivalent text format.

Function parameters

ParameterDescription Available from version
text Original text in the HTML format.
host A site web address. If specified, it is inserted before each link in HTML to form the full link.
Optional parameter. Empty by default.
delete Array of regular expression templates, which are deleted from text.
Optional parameter. Empty by default.
Prior to version of main module 9.0.7, templates were for the 'eregi_replace' function. Starting from the specified version - preg_replace function.
maxlen Inserts the <br/> tag via the number of symbols, specified in the value. To restrict the insertion go this tag, specify false.

See Also

Example of use


Call:
<?
$str = '
<table>
<tr>
<td valign=top><b><a href="/en/products/sitemanager/editions/business.php">Business</a>
- </B>full version of the product to manage an e-store, dealer network support.<BR><FONT class=smalltext><b>$1699</B>
(MySQL version)<br><b>$24500</b>
(Oracle version)</font></td>
</tr>
</table>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
';
echo HTMLToTxt($str, "http://www.bitrix.com");
?>
Result:
Business [http://www.bitrix.com/en/products/sitemanager/editions/business.php ] 
- the full version to manage an e-store, dealer network support.
$1699(MySQL version)
$24500 (Oracle version)


- Item 1
- Item 2
- Item 3


© «Bitrix24», 2001-2024
Up