本文整理汇总了PHP中CUtils::cut_text方法的典型用法代码示例。如果您正苦于以下问题:PHP CUtils::cut_text方法的具体用法?PHP CUtils::cut_text怎么用?PHP CUtils::cut_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUtils
的用法示例。
在下文中一共展示了CUtils::cut_text方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStatic
public function getStatic()
{
return CUtils::cut_text(parent::getStatic());
}
示例2: getTableSearchResults
function getTableSearchResults($text, $tableName, $where = '', $idName = '', $nName = 'name')
{
$ret = array();
$fields = $this->getSearchFieldsArray($tableName);
$fields_text = implode(',', $fields);
$search_query = '';
if (is_array($text)) {
$query_text = '';
foreach ($text as $t) {
if (strlen($t) > 2) {
$query_text .= ($query_text ? ' ' : '') . '+' . $t . '*';
}
}
$search_query = " MATCH(" . $fields_text . ") AGAINST ('" . $query_text . "' IN BOOLEAN MODE)";
} else {
$search_query = " MATCH(" . $fields_text . ") AGAINST ('\"" . $text . "\"' IN BOOLEAN MODE)";
}
$items = $GLOBALS['db']->getItems('get_search_items', "SELECT id," . $nName . ",name, " . $search_query . " AS coef FROM " . $this->tables[$tableName]->getDBTableName() . " WHERE " . $search_query . ($where ? ' AND ' . $where : '') . ' ORDER BY coef');
foreach ($items as $a) {
$ret[] = array('ref' => $this->getSearchResultRef($a, $idName), 'text' => CUtils::cut_text(strip_tags($a[$nName], 150)));
}
return $ret;
}