- Timestamp:
- 10/05/08 11:07:41 (2 months ago)
- Location:
- events/phpframework/codeigniter/trunk/system/application
- Files:
-
- 4 modified
- 1 copied
-
config/routes.php (modified) (1 diff)
-
controllers/js.php (modified) (1 diff)
-
helpers/MY_url_helper.php (modified) (1 diff)
-
views/js/jquery-1.2.6.min.js (copied) (copied from events/phpframework/codeigniter/trunk/js/jquery-1.2.6.min.js)
-
views/layout.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
events/phpframework/codeigniter/trunk/system/application/config/routes.php
r18585 r20754 44 44 $route['scaffolding_trigger'] = ""; 45 45 46 $route['js/(\S+)'] = "js/index/$1"; 46 47 47 48 /* End of file routes.php */ -
events/phpframework/codeigniter/trunk/system/application/controllers/js.php
r20297 r20754 9 9 } 10 10 11 function index( )11 function index($file = 'default.js') 12 12 { 13 $this->load->helper('url');14 13 $this->session->keep_flashdata('ticket'); 15 16 14 $this->output->set_header('Content-Type: application/x-javascript; charset=UTF-8'); 17 15 18 $offset = 60 * 60 * 24 ; // 1日16 $offset = 60 * 60 * 24 * 5; // 5日 19 17 $this->output->set_header('Expires: '.gmdate('D, d M Y H:i:s', time() + $offset).' GMT'); 20 21 $this->load->view('js/default'); 18 19 $full_path = APPPATH . 'views/js/' . $file; 20 21 if (file_exists($full_path)) 22 { 23 $this->load->file($full_path); 24 } 25 else 26 { 27 $this->load->helper('url'); 28 $x = explode('.', $file); 29 $ext = '.' . end($x); 30 $file = str_replace($ext, '', $file); 31 $this->load->view('js/' . $file); 32 } 33 22 34 } 23 35 -
events/phpframework/codeigniter/trunk/system/application/helpers/MY_url_helper.php
r20454 r20754 75 75 } 76 76 77 function js($js = 'default' )77 function js($js = 'default', $timestamp = TRUE) 78 78 { 79 $file = APPPATH . 'views/js/' . $js . '.php'; 80 $mtime = filemtime($file); 81 $date = date('YmdHs', $mtime); 79 $x = explode('.', $js); 80 $ext = '.' . end($x); 81 $file = APPPATH . 'views/js/' . $js; 82 83 if ($ext != '.js') 84 { 85 $file = $file . '.php'; 86 $js = $js. '.js'; 87 } 88 89 $date = ''; 82 90 83 $str = '<script type="text/javascript" src="' . site_url('js?' . $date) .'"></script>'; 91 if ($timestamp) 92 { 93 $mtime = filemtime($file); 94 $date = '?' . date('YmdHs', $mtime); 95 } 96 97 $str = '<script type="text/javascript" src="' . site_url('js/' . $js . $date) .'"></script>'; 84 98 return $str; 85 99 } -
events/phpframework/codeigniter/trunk/system/application/views/layout.php
r19226 r20754 16 16 <link href="<?=base_url()?>css/import.css" rel="stylesheet" type="text/css" media="all" /> 17 17 <!-- *** javascript *** --> 18 < script type="text/javascript" src="<?=base_url()?>js/jquery-1.2.6.min.js"></script>18 <?=js('jquery-1.2.6.min.js', FALSE) ?> 19 19 </head> 20 20
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)