2014-12-23 54 views
0

我的網站正在使用本地主機,但沒有在現場。Codeignitor不會顯示在Live網站上的視圖,但它確實顯示在本地主機上

這是我的代碼的一部分:

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

看到噸($數據);,這是數據的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

聽起來像在視圖本身的錯誤,請嘗試加載相同的觀點,沒有內容,這可能是由於該解釋代碼稍有不同不同的PHP版本。其中一個不是錯誤,確實是另一個錯誤。仔細檢查視圖加載是否正確 – Patrick

+0

是帕特里克,我清空標題,它的工作原理! 現在我可以找出瓶頸在哪裏 –

+0

我的第一個猜測是'<?php print asset_url()?>',注意在php關閉之前你有沒有空間?我在 – Patrick

回答

0

試試這個

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

之前遇到過一些不好的經歷如果我在頭文件中添加blolean true,那麼它在localhost上不起作用。我認爲標題中存在一些問題,我將編輯我的問題,然後放入header.php –

相關問題