Bitrix Site Manager

HTMLToTxt

string
HTMLToTxt(
 string text,
 string host = "",
 array delete = array()
)

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

Parameters

ParameterDescription
text The 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. Empty by default.
delete An array of templates specified using the regular expressions describing patterns to be deleted from text.
Optional. Empty by default.

See Also

Example



Call:

<?
$str = '
<table>
  <tr>
    <td valign=top><b><a href="/en/products/sitemanager/editions/business.php">business</a>
  - </B>the full version 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