当前位置: 首页>>代码示例>>PHP>>正文


PHP Tool::Sub_Str方法代码示例

本文整理汇总了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);
 }
开发者ID:hachi-zzq,项目名称:guest-cms,代码行数:24,代码来源:CommentAction.class.php

示例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);
 }
开发者ID:hachi-zzq,项目名称:guest-cms,代码行数:25,代码来源:IndexAction.class.php

示例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);
     //注入模板,显示本月热点
 }
开发者ID:hachi-zzq,项目名称:guest-cms,代码行数:41,代码来源:DetailAction.class.php

示例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);
 }
开发者ID:hachi-zzq,项目名称:guest-cms,代码行数:11,代码来源:FeedBackAction.class.php

示例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);
     //注入模板,显示本月热点
 }
开发者ID:hachi-zzq,项目名称:guest-cms,代码行数:73,代码来源:ListAction.class.php


注:本文中的Tool::Sub_Str方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。