2008-03-10

結合 CodeIgniter 和 SabreAMF

參考這篇 將 Zend Framework 放進 CodeIgniter
將符合 PEAR 規定的 library 掛上 CodeIgniter
1. 設定 config
修改 ci_project/system/application/config/config.php
$config['enable_hooks'] = TRUE;


2. 增加 hooks 設定
於 ci_project/system/application/config/hooks.php 增加
$hook['pre_controller'][] = array(
'class' => 'Pearroot',
'function' => 'index',
'filename' => 'pearroot.php',
'filepath' => 'hooks',
);


3. 增加 hooks 程式
於 ci_project/system/application/hooks/ 裡增加 pearroot.php
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Pearroot
{
function index()
{
set_include_path(get_include_path() . PATH_SEPARATOR . BASEPATH . 'pearroot/');
}
}
?>


4. 放置 SabreAMF 目錄
建立 ci_project/system/pearroot/ 目錄並將 SabreAMF/ 放置其底下, 就完成初步的設定。
下一篇 在 CodeIgniter 裡建立 SabreAMF 的 gateway

沒有留言:

FB 留言