Skip to content

Commit

Permalink
added nice mehtod of cutting strings
Browse files Browse the repository at this point in the history
  • Loading branch information
tungus28 committed Oct 7, 2015
1 parent f5c3d52 commit 13387c9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion controllers/NewsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ public function actionIndex()
public function getShortText($model, $key, $index, $dataColumn)
{
$name = $dataColumn->attribute;
return HtmlPurifier::process(substr($model[$name], 0, 800));//HtmlPurifier works very slowly
//return HtmlPurifier::process(substr($model[$name], 0, 800));//HtmlPurifier works very slowly

$posSpace = strpos($model[$name], ' ', 800);//todo выделить в отдельную фунцкию
return substr($model[$name], 0, $posSpace) . ' ...';
}

public function actionGetOneNews()
Expand Down

0 comments on commit 13387c9

Please sign in to comment.