Codeigniter不会在Live网站上显示该视图,但它确实显示在localhost上

时间:2014-12-23 09:31:35

标签: codeigniter

我的网站正在使用localhost,但不在现场网站上。

这是我的代码的一部分:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends CI_Controller {

function __construct() {
    parent::__construct();
    $this->load->model('dirhandler_model', '', true);
    $this->load->model('database_model', '', true);
    $this->output->enable_profiler(false);
}

function view($site, $data = array()) {
    $settings = $this->db->query(sprintf("select s_id, value, property from setting order by s_id "));
    $r_settings = $settings->result();
    $data['settings'] = $r_settings;
    $data['photos'] = $this->dirhandler_model->getPhotoFolder();
    $data['hmenu'] = $this->database_model->getMenu();
    t($data);
    $this->load->view('inc/header', $data); # when I Comment this out
    $this->load->view($site, $data);
    $this->load->view('inc/footer', $data); 
}

你看到t($ data);,这是一个print_r数据。 它显示了print_r中的数据,但是如果我删除了t($ data); 我得到一个空白页面,如果我在实际网站上查看源代码:我看到一行,这是空白的。 当我注释掉标题并查看源代码时,我会看到HTML数据

当我在localhost上运行它时,它运行正常。

我通过FTP将所有文件夹上传到了实时网站。 我不使用钩子 错误报告已启用,但没有错误。

我的header.php

<!DOCTYPE html>
    <html>
    <head>
        <meta name="robots" content="noindex, nofollow">
        <meta name="description" content="<?php print $settings[2]->value ?>">
        <title><?php print $settings[0]->value ?></title>
        <link rel="shortcut icon" href="<?php print asset_url()?>img/favicon.ico" type="image/x-icon">
        <link rel="icon" href="<?php print asset_url()?>img/favicon.ico" type="image/x-icon">
        <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
        <link rel="stylesheet" href="<?php print asset_url()?>externals/jquery_ui/jquery-ui.min.css">
        <link rel="stylesheet" href="<?php print asset_url()?>externals/bootstrap/css/bootstrap.min.css">
        <link rel="stylesheet" href="<?php print asset_url()?>externals/bootstrap/css/bootstrap-theme.min.css">
        <link rel="stylesheet" href="<?php print asset_url()?>externals/lightbox/css/blueimp-gallery.min.css">
        <link href='http://fonts.googleapis.com/css?family=PT+Serif' rel='stylesheet' type='text/css'>
        <link href='http://fonts.googleapis.com/css?family=Euphoria+Script' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" href="<?php print asset_url()?>css/style.css">
        <script src="<?php print asset_url()?>externals/jquery/jquery-1.11.1.min.js"></script>
        <script src="<?php print asset_url()?>externals/jquery_ui/jquery-ui.min.js"></script>
        <script src="<?php print asset_url()?>externals/bootstrap/js/bootstrap.min.js"></script>
    </head>
    <body>
        <div class="col-md-12">
            <div class="row">
                <div class="col-md-3 left_header">&nbsp;</div>
                <div id="title" class="col-md-7">
                    <h1><?php print $settings[0]->value ?></h1>
                </div>
                <div class="col-md-2 right_header">&nbsp;</div>
            </div>
            <div class="row">
                <ul class="nav nav-pills col-md-7 col-md-offset-3">
                    <?php 
                    foreach ($hmenu as $menuItem) {
                        $active = '';
                        if (empty($this->uri->total_segments())) {
                            $active = '';
                        }
                        elseif (!empty($this->uri->segment_array()[4]) && url_title($this->uri->segment_array()[4]) == url_title($menuItem->menu_label )) {
                            $active = '&nbsp;&nbsp;&nbsp;<span class="fa fa-arrow-circle-down"></span>';
                        } 

                        $menuLabel = ($menuItem->c_id == 1 ? site_url() : site_url('/home/content/'.$menuItem->c_id.'/'.url_title($menuItem->menu_label)));
                        printf ('
                        <li role="presentation">
                            <a href="%s">%s%s</a>
                        </li>
                        ', $menuLabel, $menuItem->menu_label, $active);
                    }
                    ?>
                </ul>
            </div>
            <div class="row">
                <div class="col-md-3">
                    <?php print $photos ?>
                    <i style="color: #FFA61C">(Wissel met F11 tussen voledige scherm en normaal scherm.)</i>
                </div>
                <div class="col-md-7" id="main-container">
                <div class="crumb text-center">
                    <?php print set_breadcrumb() ?><br />
                </div>

出了什么问题?

1 个答案:

答案 0 :(得分:0)

试试这个

$data['header '] = $this->load->view('inc/header', $data,true); 
$data['footer'] = $this->load->view('inc/footer', $data,true); 
$this->load->view($site, $data);