2012年8月13日 星期一

解決 Codeigniter-Smarty 與 Discuz X 2.5 相衝突的問題.


origin: https://github.com/QueenbyeR/blog-text/blob/master/%E8%A7%A3%E6%B1%BA%20Codeigniter-Smarty%20%E8%88%87%20Discuz%20X%202.5%20%E7%9B%B8%E8%A1%9D%E7%AA%81%E7%9A%84%E5%95%8F%E9%A1%8C/page-001.md


目錄環境

  • PHP 5.4
  • Apache 2.2
  • CodeIgniter 2.1.2
  • CodeIgniter-Smarty
  • Discuz X2.5 (2012年4月7日繁體中文UTF8)
  • CodeIgniter 在 /
  • Discuz 在 /bbs/ (程式碼會因路徑而稍微有所不同)

問題

使用 Smarty 時,在各別樣版首次執行時,\smarty_compile_dir 內若無已存在的樣版的話,會造成以下錯誤:
Discuz! System Error
Oops! System file lost: class/smarty/smarty_internal_templatecompilerbase.php

解決

打開 \www\bbs\source\class\class_core.php
找到 throw new Exception('Oops! System file lost: '.$filename);
在前一行加入
    if ( ! strpos($_SERVER['REQUEST_URI'], 'bbs') ) return true;

沒有留言:

張貼留言