convert
string convert( string text, bool bPreview = true, array arImages = array(), array arAllow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N") );
The method formats the text according to bPreview, arImages, arAllow parameters. Non-static method.
Method parameters
Parameter | Description | Available from version |
---|---|---|
text | Blog post original text. | |
bPreview | Flag - determines, whether to cut the text for viewing (per [CUT] tag). Optional. By default true - the text will be cropped to [CUT] tag. |
|
arImages | Array of the array(array(IMAGE_ID, FILE_ID)[, ...]) type.
|
|
arAllow | Array of blog post formatting parameters. Optional parameter. The following parameters are available:
SHORT_ANCHOR .
|
|
type | Optional parameter. Value by default - "html". Deleted from 10.0.0 onwards | |
arParams | Optional parameter. |
Returned value
The method returns formatted blog post.
Examples of use
<? $arPost = CBlogPost::GetByID(3); $p = new blogTextParser(); $res = CBlogImage::GetList(array("ID"=>"ASC"), array("POST_ID"=>$arPost['ID'], "BLOG_ID"=>$arPost['BLOG_ID'])); while ($arImage = $res->Fetch()) $arImages[$arImage['ID']] = $arImage['FILE_ID']; $text = $p->convert($arPost["DETAIL_TEXT"], false, $arImages); ?>
© «Bitrix24», 2001-2024