You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.2 KiB
PHP

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Information extends CI_Controller {
public function __construct() {
parent::__construct();
//$this->output->enable_profiler(TRUE);
$this->load->model('Information_model');
$this->load->model('InfoMetas_model');
$this->load->library('Tags_analysis');
}
public function index() {
echo 'Information Index';
}
//优先使用传入的URL用于主动生成静态页面去映射(优先使用POST参数)
public function detail($url = '') {
$data = array();
if (empty($url)) {
$url = $this->input->get_post('static_html_url');
}
if (empty($url) || $url == 'index.php') {
$url = get_origin_url();
if (preg_match('/\?.*/', $url) == 1) {
$url = preg_replace('/\?.*/', '', $url);
php_301($url);
return;
}
}
//大小写转向只要url有大写字母的全部转到小写字母的url上
if ($url != mb_strtolower($url)) {
php_301(mb_strtolower($url));
return;
}
$data['detail'] = $this->Information_model->get_detail($url);
if ($data['detail'] === false) {
// send_404($this);todo写一个友好的404页面
redirect('/error/page_not_found');
return false;
}
$data['detail']->ic_content = $this->tags_analysis->analysis($data['detail']);
$data['seo_title'] = $data['detail']->ic_seo_title;
$data['seo_keywords'] = $data['detail']->ic_seo_keywords;
$data['seo_description'] = $data['detail']->ic_seo_description;
$data['seo_url'] = $data['detail']->ic_url;
$data['meta_addon_css'] = $this->InfoMetas_model->get($data['detail']->ic_id, 'meta_addon_css');
$data['meta_addon_js'] = $this->InfoMetas_model->get($data['detail']->ic_id, 'meta_addon_js');
$this->load->view('header', $data);
$this->load->view('information_' . $data['detail']->ic_template);
$this->load->view('footer');
$this->output->cache(0);
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */