对描述信息进行简短处理,以300字为界。

This commit is contained in:
wlx 2009-12-20 07:54:34 +00:00
parent e3d78bf803
commit d23c5896bc
1 changed files with 6 additions and 2 deletions

View File

@ -275,8 +275,12 @@ class DataController extends Zend_Controller_Action
$timexml='<data>'; $timexml='<data>';
foreach($rows as $row) { foreach($rows as $row) {
$timexml.='<event start="'.date($dateformat,strtotime($row['timebegin'])).'" '; $timexml.='<event start="'.date($dateformat,strtotime($row['timebegin'])).'" ';
if ($row['timeend']!='') $timexml.=' end="'.date($dateformat,strtotime($row['timeend'])).'" '; if ($row['timeend']!='') $timexml.=' end="'.date($dateformat,strtotime($row['timeend'])).'" isDuration="true"';
$timexml.= ' title="'.$row['title'].'" image="/images/westdc_40w.gif" link="/data/'.$row['uuid'].'">'.htmlspecialchars($row['description']).'</event>'; $timexml.= ' title="'.$row['title'].'" image="/images/westdc_40w.gif" link="/data/'.$row['uuid'].'">';
$desc_length=mb_strlen($row['description'],"UTF-8");
$desc=mb_substr($row['description'],0,($desc_length>300)?300:$desc_length,"UTF-8");
if ($desc_length>300) $desc.=" ...";
$timexml.=htmlspecialchars($desc).'</event>';
} }
$timexml.='</data>'; $timexml.='</data>';
$fp=fopen('time.xml','w'); $fp=fopen('time.xml','w');