本文整理匯總了PHP中Tool::Sub_Str方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tool::Sub_Str方法的具體用法?PHP Tool::Sub_Str怎麽用?PHP Tool::Sub_Str使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Tool
的用法示例。
在下文中一共展示了Tool::Sub_Str方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Comment_Show
private function Comment_Show()
{
global $templates;
$templates->assgin('title', '評論列表');
$templates->assgin('show', true);
parent::Page($this->model->All_Comment_Num());
$object = $this->model->Get_ALL_List();
if (!empty($object)) {
foreach ($object as $value) {
$value->content_full = $value->content;
$value->content = Tool::Sub_Str($value->content, 50);
if ($value->state == 0) {
$value->state_num = $value->state;
$value->state = '<span style="color:red;">[未審核]</span>|<a href="comment.php?id=' . $value->id . '&action=agree"><span style="color:blue;">通過</span></a>';
} else {
if ($value->state == 1) {
$value->state_num = $value->state;
$value->state = '<span style="color:blue">[已審核]</span>';
}
}
}
}
$templates->assgin('all_comment_list', $object);
}
示例2: Get_Four
private function Get_Four()
{
global $templates;
$content = new ContentModel();
$object = $content->Index_Four();
$i = 1;
foreach ($object as $value) {
if ($i % 2 == 0) {
$value->class = 'list right bottom';
} else {
$value->class = 'list bottom';
}
$content->nav = $value->id;
$object_list = $content->Index_Four_list();
$value->list = $object_list;
foreach ($object_list as $value) {
$value->title = Tool::Sub_Str($value->title, 20);
//對title進行截取
$value->date = date('m-d', strtotime($value->date));
//將時間格式轉換一下
}
$i++;
}
$templates->assgin('index_four', $object);
}
示例3: Show_Month
private function Show_Month()
{
global $templates;
$content = new ContentModel();
$content->id = $_GET['id'];
$parid = $content->Get_Par_Id();
$content->nav = $parid->nav;
//列出本月推薦
$object_rec = $content->Month_Rec();
if ($object_rec) {
foreach ($object_rec as $value) {
$value->title = Tool::Sub_Str($value->title, 15);
$value->date = date('m-d', strtotime($value->date));
//將時間格式轉換一下
}
}
$templates->assgin('Month_Rec', $object_rec);
//注入模板,顯示本月推薦
//列出本月熱點
$object_hot = $content->Month_Hot();
if ($object_hot) {
foreach ($object_hot as $value) {
$value->title = Tool::Sub_Str($value->title, 15);
$value->date = date('m-d', strtotime($value->date));
//將時間格式轉換一下
}
}
$templates->assgin('Month_Hot', $object_hot);
//注入模板,顯示本月熱點
//列出本月圖文(含有圖片的wenzha)
$object_pic = $content->Month_Pic();
if ($object_pic) {
foreach ($object_pic as $value) {
$value->title = Tool::Sub_Str($value->title, 15);
$value->date = date('m-d', strtotime($value->date));
//將時間格式轉換一下
}
}
$templates->assgin('Month_pic', $object_pic);
//注入模板,顯示本月熱點
}
示例4: Hot_Content
private function Hot_Content()
{
global $templates;
$content = new ContentModel();
$object = $content->Hot_Content();
foreach ($object as $value) {
$value->date = substr($value->date, 5, 5);
$value->title = Tool::Sub_Str($value->title, 15);
}
$templates->assgin('hot_content', $object);
}
示例5: Get_Contentlist
private function Get_Contentlist()
{
global $templates;
$content = new ContentModel();
$nav = new NavModel();
$nav->id = $_GET['id'];
$object_child = $nav->selectchildNav_nolimit();
//根據父導航ld找到子導航
foreach ($object_child as $value_child) {
$id[] = $value_child->id;
}
if ($object_child) {
$in = implode(',', $id);
$content->nav = $in;
//sQL語句中IN關鍵字
} else {
$content->nav = $_GET['id'];
}
$countArr = $content->Get_Contentlist();
$count = $countArr->c;
//得到記錄數
$page = new Page($count, PAGE_SIZE);
$content->limit = $page->limit;
//注入limit值
$templates->assgin('page', $page->Show_Page_Num());
//顯示分頁
$object = $content->Get_Content();
//獲取所有的content
foreach ($object as $value) {
$value->title = Tool::Sub_Str($value->title, 15);
//對title進行截取
$value->info = Tool::Sub_Str($value->info, 120);
//對info進行截取
if (empty($value->thumbnail)) {
$value->thumbnail = 'images/none.jpg';
}
}
$templates->assgin('AllContent', $object);
//注入模板,顯示content
//列出本月推薦
$object_rec = $content->Month_Rec();
if ($object_rec) {
foreach ($object_rec as $value) {
$value->title = Tool::Sub_Str($value->title, 15);
$value->date = date('m-d', strtotime($value->date));
//將時間格式轉換一下
}
}
$templates->assgin('Month_Rec', $object_rec);
//注入模板,顯示本月推薦
//列出本月熱點
$object_hot = $content->Month_Hot();
if ($object_hot) {
foreach ($object_hot as $value) {
$value->title = Tool::Sub_Str($value->title, 15);
$value->date = date('m-d', strtotime($value->date));
//將時間格式轉換一下
}
}
$templates->assgin('Month_Hot', $object_hot);
//注入模板,顯示本月熱點
//列出本月圖文(含有圖片的wenzha)
$object_pic = $content->Month_Pic();
if ($object_pic) {
foreach ($object_pic as $value) {
$value->title = Tool::Sub_Str($value->title, 15);
$value->date = date('m-d', strtotime($value->date));
//將時間格式轉換一下
}
}
$templates->assgin('Month_pic', $object_pic);
//注入模板,顯示本月熱點
}