本文整理汇总了PHP中utf_substr函数的典型用法代码示例。如果您正苦于以下问题:PHP utf_substr函数的具体用法?PHP utf_substr怎么用?PHP utf_substr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了utf_substr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: event_toggle
function event_toggle()
{
$get_data = $this->input->get();
$id = $get_data['id'];
$i = $get_data['i'];
$this->load->model('schedule_model');
$where = array('id' => $id);
$data = $this->schedule_model->get_row_array($where);
if (!empty($data)) {
if ($i % 2 == 0) {
echo $data['intro'];
} else {
if ($i % 2 == 1) {
$intro = utf_substr($data['intro'], 180);
if (strlen($data['intro']) >= 180) {
$intro .= "...";
}
echo $intro;
}
}
}
}
示例2: base_url
" style="max-width:80px; max-height:80px;"></a>
<span class="vip"><img src="<?php
echo base_url();
?>
useful/img/vip.png" class="png"></span>
</div>
</div>
<p class="name_address"><span><?php
echo @$v['exh_data']['ground_name'];
?>
</span><?php
echo @$v['exh_data']['ground_address'];
?>
</p>
<p class="words" style="min-height:42px;"><?php
echo @utf_substr($v['exh_data']['intro'], 300);
?>
</p>
<p class="more"><a href="fair.php"><img src="<?php
echo base_url();
?>
useful/img/icon_more_p1.png"></a></p>
</div>
</div>
<?php
if ($myself) {
?>
<div class="add_delete">
<p class="png">
<?php
示例3: array
$cate_list[] = array('id' => $DB_Record[0], 'title' => $DB_Record[1]);
}
}
//每月条数统计
//------------------------------0----===========--1
$SqlStr = 'SELECT COUNT(left(posttime,7)), left(posttime,7) as `sj` FROM `' . DB_TABLE_PRE . 'mb_blog` GROUP By `sj` Order By `posttime` DESC LIMIT 5;';
$MyDatabase->SqlStr = $SqlStr;
if ($MyDatabase->Query()) {
$DB_Record_Arr = $MyDatabase->ResultArr;
foreach ($DB_Record_Arr as $DB_Record) {
$posttime_list[] = array('count' => $DB_Record[0], 'month' => $DB_Record[1]);
}
}
//quick列表
//-------------------0
$SqlStr = ' SELECT `title` from `' . DB_TABLE_PRE . 'mb_quick`';
$SqlStr .= ' ORDER BY `id` DESC';
$SqlStr .= ' LIMIT 5;';
$MyDatabase->SqlStr = $SqlStr;
if ($MyDatabase->Query()) {
$DB_Record_Arr = $MyDatabase->ResultArr;
foreach ($DB_Record_Arr as $DB_Record) {
$quick_list[] = array('title_long' => $DB_Record[0], 'title' => utf_substr($DB_Record[0], 42));
}
}
//管理员日志
$ThisPage = 'index.php';
$log_content = 'Blog列表';
require 'include/log.php';
require PAGENAME . '.php';
require 'include/debug.php';
示例4: getLastServices
<td height="24" align="left" valign="middle"><?php
echo getLastServices($list['id']);
?>
</td>
<td height="24" align="left" valign="middle"><?php
echo date('Y-m-d', strtotime($list['dateline']));
?>
<br><?php
echo empty($list['managerid']) ? "公海" : getRealnamebyName($list['managerid']);
?>
</td>
<td width="15%" height="24" align="left" valign="middle"> <?php
if ($industry == '4') {
echo $list['rank'];
} else {
echo "<a href='customer_action.php?act=mod&id=" . $list['id'] . "&tab=0' title='" . $list['services'] . "'>" . utf_substr($list['services'], 20) . "</a>";
}
?>
</td>
<td height="24" align="center" valign="middle"> <a href="customer_action.php?act=mod&id=<?php
echo $list['id'];
?>
&page=<?php
echo $page;
?>
"><img src="../images/edit.gif" border="0" /></a>
<?php
if ($_SESSION['supermanager'] < 6) {
?>
<a href="customer_ok.php?id=<?php
echo $list['id'];
示例5: array
DB::run()->query("UPDATE `forums` SET `forums_last_id`=?, `forums_last_themes`=?, `forums_last_user`=?, `forums_last_time`=? WHERE `forums_id`=?;", array($tid, $topics['topics_title'], $log, SITETIME, $topics['forums_parent']));
}
}
// -- Загрузка файла -- //
if (!empty($_FILES['file']['name']) && !empty($lastid)) {
if ($udata['users_point'] >= $config['forumloadpoints']) {
if (is_uploaded_file($_FILES['file']['tmp_name'])) {
$filename = check($_FILES['file']['name']);
$filename = !is_utf($filename) ? utf_lower(win_to_utf($filename)) : utf_lower($filename);
$filesize = $_FILES['file']['size'];
if ($filesize > 0 && $filesize <= $config['forumloadsize']) {
$arrext = explode(',', $config['forumextload']);
$ext = getExtension($filename);
if (in_array($ext, $arrext) && $ext != 'php') {
if (utf_strlen($filename) > 50) {
$filename = utf_substr($filename, 0, 45) . '.' . $ext;
}
if (!file_exists(BASEDIR . '/upload/forum/' . $topics['topics_id'])) {
$old = umask(0);
mkdir(BASEDIR . '/upload/forum/' . $topics['topics_id'], 0777, true);
umask($old);
}
$num = 0;
$hash = $lastid . '.' . $ext;
while (file_exists(BASEDIR . '/upload/forum/' . $topics['topics_id'] . '/' . $hash)) {
$num++;
$hash = $lastid . '_' . $num . '.' . $ext;
}
move_uploaded_file($_FILES['file']['tmp_name'], BASEDIR . '/upload/forum/' . $topics['topics_id'] . '/' . $hash);
DB::run()->query("INSERT INTO `files_forum` (`file_topics_id`, `file_posts_id`, `file_hash`, `file_name`, `file_size`, `file_user`, `file_time`) VALUES (?, ?, ?, ?, ?, ?, ?);", array($topics['topics_id'], $lastid, $hash, $filename, $filesize, $log, SITETIME));
} else {
示例6: date
<div class="hover">
<div class="hover_inner">
<div class="top clearfix">
<div class="words_con">
<p class="name"><span><?php echo @$temp['g_country']?></span><span><?php echo @$temp['g_province']?></span><?php echo @$temp['g_city']; ?></p>
<p class="timing"><?php echo date("Y.m.d", $temp['begin_time']) . ' - ' . date("Y.m.d", $temp['end_time']); ?></p>
<h2><?php echo $temp['title']; ?></h2>
</div>
<div class="pic" style="height:80px;"><a href="<?php echo base_url('exhibition/index?id='.$temp['id']); ?>"><img src="<?php echo base_url(); ?><?php echo $temp['pic']; ?>" style="max-width:80px; max-height:80px;"></a>
<?php if(!empty($temp['is_pass'])){ if($temp['is_pass'] == 1){ ?>
<span class="vip"><img src="<?php echo base_url(); ?>useful/img/vip.png" class="png"></span>
<?php }} ?>
</div>
</div>
<p class="name_address"><span><?php if(!empty($temp['ground_name'])){ echo $temp['ground_name']; } ?></span><?php if(!empty($temp['ground_place'])){ echo $temp['ground_place']; } ?></p>
<div class="words" style="min-height:32px;"><?php if(!empty($temp['intro'])){ echo utf_substr($temp['intro'],100); } ?><?php if(!empty($temp['intro'])){ if(strlen($temp['intro']) >= 100){ echo "..."; } } ?></div>
<p class="more"><a href="<?php if(!empty($temp['exhibition_url']) && isset($temp['exhibition_url'])){ echo $temp['exhibition_url']; } ?>"><img src="<?php echo base_url();?>useful/img/icon_more_p1.png"></a></p>
</div>
</div>
</li>
<?php } ?>
<?php }else{ ?>
<div style="width:auto; height:300px; border:0px solid red; padding:20px; font-size:14px; color:red">未找到你要的数据,抱歉,请重新查询</div>
<?php } ?>
</ul>
</div>
<style>
.xpager ul li{
float: left;
margin-bottom: 20px;
示例7: build_caption
/**
* build_caption()
*
* @param array $rowset by reference
* @param array $must_have
**/
function build_caption(&$rowset, $must_have = array())
{
global $CONFIG, $THEME_DIR;
global $album_date_fmt, $lastcom_date_fmt, $lastup_date_fmt, $lasthit_date_fmt, $cat;
global $lang_get_pic_data, $lang_meta_album_names, $lang_errors;
foreach ($rowset as $key => $row) {
$caption = '';
if ($CONFIG['display_filename']) {
$caption .= '<span class="thumb_filename">' . $row['filename'] . '</span>';
}
$caption .= $row['title'] ? '<span class="thumb_title">' . $row['title'] . '</span>' : '';
if ($CONFIG['views_in_thumbview'] || in_array('hits', $must_have)) {
$caption .= '<span class="thumb_title">' . sprintf($lang_get_pic_data['n_views'], $row['hits']) . '</span>';
}
if ($CONFIG['caption_in_thumbview']) {
$caption .= $row['caption'] ? "<span class=\"thumb_caption\">" . strip_tags(bb_decode($row['caption'])) . "</span>" : '';
}
if ($CONFIG['display_comment_count']) {
$comments_nr = count_pic_comments($row['pid']);
if ($comments_nr > 0) {
$caption .= "<span class=\"thumb_num_comments\">" . sprintf($lang_get_pic_data['n_comments'], $comments_nr) . "</span>";
}
}
if ($CONFIG['display_uploader']) {
$caption .= $row['owner_id'] && $row['owner_name'] ? '<span class="thumb_title"><a href ="profile.php?uid=' . $row['owner_id'] . '">' . $row['owner_name'] . '</a></span>' : '';
}
if (in_array('msg_date', $must_have)) {
$caption .= '<span class="thumb_caption">' . localised_date($row['msg_date'], $lastcom_date_fmt) . '</span>';
}
if (in_array('msg_body', $must_have)) {
$msg_body = strip_tags(bb_decode($row['msg_body']));
// I didn't want to fully bb_decode the message where report to admin isn't available. -donnoman
$msg_body = utf_strlen($msg_body) > 50 ? utf_substr($msg_body, 0, 50) . '...' : $msg_body;
if ($CONFIG['enable_smilies']) {
$msg_body = process_smilies($msg_body);
}
if ($row['author_id']) {
$caption .= '<span class="thumb_caption"><a href ="profile.php?uid=' . $row['author_id'] . '">' . $row['msg_author'] . '</a>: ' . $msg_body . '</span>';
} else {
$caption .= '<span class="thumb_caption">' . $row['msg_author'] . ': ' . $msg_body . '</span>';
}
}
if (in_array('ctime', $must_have)) {
$caption .= '<span class="thumb_caption">' . localised_date($row['ctime'], $lastup_date_fmt) . '</span>';
}
if (in_array('pic_rating', $must_have)) {
if (defined('THEME_HAS_RATING_GRAPHICS')) {
$prefix = $THEME_DIR;
} else {
$prefix = '';
}
$caption .= "<span class=\"thumb_caption\">" . '<img src="' . $prefix . 'images/rating' . round($row['pic_rating'] / 2000) . '.gif" alt=""/>' . '<br />' . sprintf($lang_get_pic_data['n_votes'], $row['votes']) . '</span>';
}
if (in_array('mtime', $must_have)) {
$caption .= "<span class=\"thumb_caption\">" . localised_date($row['mtime'], $lasthit_date_fmt);
if (GALLERY_ADMIN_MODE) {
$caption .= "<br/>" . $row['lasthit_ip'];
}
$caption .= '</span>';
}
$rowset[$key]['caption_text'] = $caption;
}
$rowset = CPGPluginAPI::filter('thumb_caption', $rowset);
}
示例8: file
$fileforum = file(DATADIR . "dataforum/mainforum.dat");
$total = count($fileforum);
if ($total > 0) {
foreach ($fileforum as $forumval) {
$forum = explode("|", $forumval);
echo '<div class="b"><img src="/images/img/forums.gif" alt="image" /> ';
echo '<b><a href="forum.php?fid=' . $forum[0] . '&' . SID . '">' . $forum[1] . '</a></b> (' . $forum[2] . '/' . $forum[3] . ')</div>';
$totalforum = counter_string(DATADIR . "dataforum/topic" . $forum[0] . ".dat");
if ($totalforum > 0) {
$filetopic = file(DATADIR . "dataforum/topic" . $forum[0] . ".dat");
$topic = explode("|", end($filetopic));
if (file_exists(DATADIR . 'dataforum/' . $forum[0] . '-' . $topic[0] . '.dat')) {
$filepost = file(DATADIR . 'dataforum/' . $forum[0] . '-' . $topic[0] . '.dat');
$post = explode("|", end($filepost));
if (utf_strlen($topic[3]) > 35) {
$topic[3] = utf_substr($topic[3], 0, 30);
$topic[3] .= "...";
}
echo '<div>Тема: <a href="topic.php?act=end&fid=' . $forum[0] . '&id=' . $topic[0] . '&' . SID . '">' . $topic[3] . '</a><br />';
echo 'Сообщение: ' . nickname($post[2]) . ' (' . date_fixed($post[6]) . ')</div>';
} else {
echo 'Последняя тема не найдена!';
}
} else {
echo 'Раздел пустой! Темы еще не созданы!';
}
}
echo '<br />Всего разделов: <b>' . $total . '</b><br /><br />';
} else {
show_error('Форум пустой! Разделы еще не созданы!');
}
示例9: utf_substr
echo $arr_user['business'];
?>
</li>
<?php
}
?>
-->
</ul>
<?php
if (!empty($arr_user['intro'])) {
?>
<div class="show_intro showdetail">
<div class="_intro"><p><?php
echo utf_substr($arr_user['intro'], 300);
?>
</p></div>
</div>
<p class="more1"><a class="intro_up" style="cursor:pointer;" onClick="hide_intro('hide','<?php
echo @$arr_user['id'];
?>
')"></a> <a class="intro_down" onClick="hide_intro('show','<?php
echo @$arr_user['id'];
?>
')" style="display:none; cursor:pointer;"></a></p>
<?php
}
?>
<form action="<?php
示例10: utf_substr
<div class="goods-pic">
<a href="<?php
echo $array['click_url'];
?>
" target="_blank">
<img src="<?php
echo $array['pic_url'];
?>
" alt="" title="<?php
echo $array['title'];
?>
">
</a>
</div>
<div class="op"><?php
echo utf_substr($array['title'], 40);
?>
</div>
<div class="op">
<div class="desc">
<strong>¥<?php
echo $array['price'];
?>
</strong>
</div>
<div class="buttonline">
<a href="<?php
echo $array['click_url'];
?>
" title="去购买"
class="btn btn-success" target="_blank">去购买
示例11: utf_substr
<?php
}
?>
</table>
</div>
</div>
<div class="product">
<?php
if (!empty($items['product_range']) && isset($items['product_range'])) {
?>
<p>展品范围</p>
<div class="more_product_range showdetail">
<div class="more_product_in">
<p><?php
echo utf_substr(strip_tags($items['product_range']), 200);
?>
</p>
</div>
</div>
<?php
if (strlen(strip_tags($items['product_range'])) > 200) {
?>
<p class="more"><a class="a_up range_up" style="text-decoration:none; cursor:pointer" onClick="hide_text('hide','<?php
echo @$items['id'];
?>
','product_range')"></a> <a class="a_down range_down" style="text-decoration:none; cursor:pointer; display:none;" onClick="hide_text('show','<?php
echo @$items['id'];
?>
','product_range')"></a></p>
<?php
示例12: defaults_show
function defaults_show()
{
$num = $this->input->post('num');
$now_num = 4 - $num;
$this->db->where('business', '百亿特辑');
$this->db->limit($now_num);
$this->db->order_by('id', 'random');
$query = $this->db->get('exhibition');
$data = $query->result_array();
/*if(!empty($data))
{
foreach($data as $k=>$v)
{
//判断是否为
}
}*/
$html_result = '';
$html_product = '';
foreach ($data as $key => $item) {
$html_result .= '
<li>
<div class="pin">
<div class="top clearfix">
<div class="time">
<p><span>' . date('Y', $item['begin_time']) . '</span><br>
' . date('m.d', $item['begin_time']) . '<br>
<span>' . date('Y', $item['end_time']) . '</span><br>
' . date('m.d', $item['end_time']) . '</p>
</div>
<div class="pic" style="height:80px;">
<a href="' . base_url('exhibition/index?id=' . $item['id']) . '" target="_blank"><img src="' . base_url($item['pic']) . '" style="max-width:80px; max-height:80px;"></a>
<span class="vip"><img src="' . base_url('useful/img/vip.png') . '" class="png"></span>
</div>
</div>
<p class="name"><span>' . @$item['country'] . '</span><span>' . @$item['province'] . '</span>' . @$item['city'] . '</p>
<p class="words" style="height:50px;">' . @utf_substr($item['title'], 54) . '</p>
</div>
<div class="hover">
<div class="hover_inner">
<div class="top clearfix">
<div class="words_con">
<p class="name"><span>' . @$item['country'] . '</span><span>' . @$item['province'] . '</span>' . @$item['city'] . '</p>
<p>' . date("Y-m-d", $item['begin_time']) . '-' . date("Y-m-d", $item['end_time']) . '</p>
<h2>' . @$item['title'] . '</h2>
</div>
<div class="pic" style="height:80px;">
<a href="" target="_blank"><img src="' . base_url($item['pic']) . '" style="max-width:80px; max-height:80px;"></a>
<span class="vip"><img src="' . base_url('useful/img/vip.png') . '" class="png"></span>
</div>
</div>
<p class="name_address"><span>' . @$item['ground_name'] . '</span>' . @$item['ground_address'] . '</p>
<p class="words" style="min-height:32px;">' . @utf_substr($item['intro'], 400) . '</p>
<p class="more"><a href="' . base_url('exhibition/index?id=' . $item['id']) . '" target="_blank"><img src="' . base_url('useful/img/icon_more_p1.png') . '"></a></p>
</div>
</div>
</li>';
}
echo $html_result;
}
示例13: getdata
function getdata($sqlstr, $code)
{
global $db;
$sort_list = $db->getlist($sqlstr);
foreach ($sort_list as $list) {
preg_match_all('/<luocms([\\s\\S]*?)>([\\s\\S]*?)<\\/luocms>/', $code, $block_list);
$hreftemp = $block_list[2][0];
$formtemp = $block_list[1][0];
$hreftempnew = $hreftemp;
preg_match_all('/src=(\\")(.*?)(\\")/', $formtemp, $srclist);
//得到是哪个表的内容
$src_temp = $srclist[2][0];
preg_match_all('/src=(\\")(.*?)(\\")/', $hreftemp, $srclist);
//要生成的缩略图的部分
$s_pic_temp = $srclist[2][0];
//echo $s_pic_temp;
preg_match_all('/\\[(.*?)\\swidth=(\'|\\")(.*?)(\'|\\")\\sheight=(\'|\\")(.*?)(\'|\\")\\]/', $s_pic_temp, $picturex);
//生成缩略图并替换标签
$pxMax = count($picturex[0]);
//echo $pxMax;
for ($p = 0; $p < $pxMax; $p++) {
$pp = $picturex[1][$p];
//echo $picturex[0][$p];
$ppw = $picturex[3][$p];
$pph = $picturex[6][$p];
$p_picture = $this->get_content_row($list['id'], 'picture');
if (!empty($ppw) && !empty($pph)) {
$img_ext = strrchr($p_picture, '.');
$p_smallpic = substr($p_picture, 0, strlen($p_picture) - strlen($img_ext)) . "_s" . $img_ext;
if (!file_exists($p_smallpic)) {
$temp = new CreatMiniature();
$temp->SetVar($p_picture, $img_ext);
$temp->BackFill('./' . $p_smallpic, $ppw, $pph, "255", "255", "255");
}
$temp_img = "../" . $p_smallpic;
} else {
$temp_img = "../" . $p_picture;
}
//echo $picturex[0][$p];
$hreftempnew = str_replace($picturex[0][$p], $temp_img, $hreftempnew);
}
preg_match_all('/\\[luo\\.(.*?)\\]/', $hreftemp, $tName);
//处理截取字符标签[luo.cotnent len='180']
$tArrMax = count($tName[0]);
for ($k = 0; $k < $tArrMax; $k++) {
$t1 = strtolower($tName[0][$k]);
// 属性名称[luo.title]
$t2 = strtolower($tName[1][$k]);
//字段名title
preg_match_all('/(.*?)x\\slen=(\'|\\")(.*?)(\'|\\")/', $t2, $titlex);
$txArrMax = count($titlex[0]);
for ($w = 0; $w < $txArrMax; $w++) {
$ttr = $titlex[1][$w];
$tx = $titlex[0][$w];
$txx = "[luo." . $tx . "]";
$len = $titlex[3][$w];
$temp_c_value = get_html_replace($list[$ttr]);
$temp_sub_str = utf_substr(htmlspecialchars(strip_tags(stripslashes($temp_c_value))), $len);
$temp_sub_str_ext = strlen($list[$ttr]) > $len ? $temp_sub_str . "..." : $temp_sub_str;
$hreftempnew = str_replace($txx, $temp_sub_str_ext, $hreftempnew);
}
switch ($t2) {
//替换内容标签[luo.*]
case "url":
//链接
switch ($src_temp) {
//根据当前表名用不同的链接地址
case "content":
//内容表
$urltemp = $this->get_tpl_name($this->getclassid($list['id']), 'templateview') . "_" . $list['id'] . $GLOBALS[rewriteext];
$hreftempnew = str_replace($t1, $urltemp, $hreftempnew);
break;
case "link":
//友情链接表
$urltemp = $list['url'];
$hreftempnew = str_replace($t1, $urltemp, $hreftempnew);
break;
}
break;
case "classurl":
//导航类别中地址
$urltemp = $this->get_tpl_name($list['id'], 'template') . "-" . $list['id'] . $GLOBALS[rewriteext];
$hreftempnew = str_replace($t1, $urltemp, $hreftempnew);
break;
case "content":
//内容
$hreftempnew = str_replace($t1, strip_tags(stripslashes($list[$t2])), $hreftempnew);
break;
case "contentc":
//显示单条内容时不用去除样式
$hreftempnew = str_replace($t1, stripslashes($list["content"]), $hreftempnew);
break;
case "title":
//标题
$title = getstyle("content", $list['id'], $list['title']);
$hreftempnew = str_replace($t1, $title, $hreftempnew);
break;
case "picture":
//原始大小图片
$hreftempnew = str_replace($t1, '../' . $this->get_content_row($list['id'], 'picture'), $hreftempnew);
//.........这里部分代码省略.........
示例14: check
$otkel = check(no_br($_POST['otkel']));
$infa = check(no_br($_POST['infa']));
$mobila = check(no_br($_POST['mobila']));
$icq = check($_POST['icq']);
$pol = check(no_br($_POST['pol']));
$rost = (int) $_POST['rost'];
$ves = (int) $_POST['ves'];
$site = check($_POST['site']);
$happy = check($_POST['happy']);
if ($uid == $_SESSION['token']) {
if (preg_match('#^http://([a-z0-9_\\-\\.])+(\\.([a-z0-9\\/])+)+$#', $site) || $site == "") {
if (preg_match('#^[0-9]{1,2}+\\.[0-9]{2}+\\.([0-9]{2}|[0-9]{4})$#', $happy) || $happy == "") {
$otkel = utf_substr($otkel, 0, 50);
$infa = utf_substr($infa, 0, 500);
$mobila = utf_substr($mobila, 0, 30);
$my_name = utf_substr($my_name, 0, 50);
change_profil($log, array(2 => $otkel, 3 => $infa, 5 => $site, 13 => $mobila, 14 => $ip, 15 => $pol, 16 => $rost, 17 => $ves, 18 => $happy, 19 => $icq, 29 => $my_name));
header("Location: profil.php?isset=editprofil&" . SID);
exit;
} else {
echo '<img src="../images/img/error.gif" alt="image" /> <b>Неправильный формат даты рождения, необходим формат дд.мм.гг</b><br />';
}
} else {
echo '<img src="../images/img/error.gif" alt="image" /> <b>Неправильный адрес сайта, необходим формата http://my_site.domen</b><br />';
}
} else {
echo '<img src="../images/img/error.gif" alt="image" /> <b>Ошибка! Неверный идентификатор сессии, повторите действие!</b><br />';
}
echo '<br /><img src="../images/img/back.gif" alt="image" /> <a href="profil.php?' . SID . '">Вернуться</a><br />';
}
} else {
示例15: utf_shorttext
function utf_shorttext($str, $len)
{
$s = utf_substr($str, $len);
if ($s != $str) {
$s .= '...';
}
return $s;
}