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); }