index.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. !defined('BASEPATH') && exit('No direct script access allowed');
  3. class Index extends MY_Main_Controller
  4. {
  5. public function __construct()
  6. {
  7. parent::__construct();
  8. $this->load->model('homepage_model','homepage');
  9. $this->load->model('web_setting_model','web_setting');
  10. }
  11. public function index()
  12. {
  13. $name = 'slider';
  14. $items = $this->homepage->all();
  15. $item = $this->web_setting->getValueByName($name);
  16. $data['slider'] = json_decode($item[0]['value'] , true);
  17. $data['items'] = $items;
  18. $this->load_view($data);
  19. }
  20. public function index1()
  21. {
  22. $name = 'slider';
  23. $items = $this->homepage->all();
  24. $item = $this->web_setting->getValueByName($name);
  25. $data['slider'] = json_decode($item[0]['value'] , true);
  26. $data['items'] = $items;
  27. $this->action_name = __FUNCTION__;
  28. $this->load_view($data);
  29. }
  30. // public function fuckData()
  31. // {
  32. // $this->load->model('news_model','news');
  33. // $json = file_get_contents('F:\\dt_article.json');
  34. // $json_arr = json_decode($json , true);
  35. // $data = $json_arr['RECORDS'];
  36. // foreach ($data as $key => $value) {
  37. // $parm['type'] = $value['type'];
  38. // $parm['title'] = $value['title'];
  39. // $parm['author'] = $value['author'] ? $value['author'] : '';
  40. // $parm['from'] = $value['from'] ? $value['from'] : '';
  41. // $parm['ord'] = $value['ord'];
  42. // $parm['pv'] = $value['pv'];
  43. // $parm['publishtime'] = strtotime($value['publishtime']);
  44. // $parm['addtime'] = time();
  45. // $parm['img'] = "http://www.usky.cn".$value['img'];
  46. // $parm['desc'] = $value['desc'] ? $value['desc'] : '';
  47. // $parm['content'] = $value['content'];
  48. // $this->news->insert($parm);
  49. // $parm = '';
  50. // }
  51. // }
  52. //
  53. // public function sortData($value='')
  54. // {
  55. // $this->load->model('news_model','news');
  56. // $all = $this->news->all_order_time();
  57. // $i = 1;
  58. // foreach ($all as $key => $value) {
  59. // $parm['ord'] = $i++;
  60. // $this->news->update($value['id'] , $parm);
  61. // }
  62. // }
  63. }
  64. ?>