Welcome Guest, Not a member yet? Register   Sign In
Include external library
#2

[eluser]heenji[/eluser]
you could try this steps:

copy phprtflite's lib content to CI application/librarys/PHPRtfLite,
create a PHPRTFLITE.php in application/librarys,it content like following:
Code:
<?php
if (!defined('BASEPATH')) {exit('No direct script access allowed');}
class CI_PHPRTFLITE
{
/**
* Constructor
*
* @param string $class class name
*/
function __construct($class = NULL)
{

ini_set('include_path',
ini_get('include_path') . PATH_SEPARATOR . APPPATH . 'libraries/PHPRtfLite');

if ($class)
{
require_once (string) $class . EXT;
log_message('debug', "PHPRtfLite Class $class Loaded");
}
else
{
log_message('debug', "PHPRtfLite Class Initialized");
}
}

/**
* PHPRtfLite Class Loader
*
* @param string $class class name
*/
function load($class)
{
require_once (string) $class . EXT;
log_message('debug', "PHPRtfLite Class $class Loaded");
}
}
?>

make a controller and method like this:
Code:
public function testrtf(){
  $this->load->library('phprtflite');
        $this->phprtflite->load('PHPRtfLite/PHPRtfLite');

  PHPRtfLite::registerAutoloader();
  $rtf = new PHPRtfLite();
  $sect = $rtf->addSection();
  $sect->writeText('<i>hello<b>world</b></i>.', new PHPRtfLite_Font(12), new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER));

  // save rtf document
  $rtf->save('hello.rtf');
  echo 'create ok,and download <a href="'.base_url().'hello.rtf">here</a>';
  
}



Messages In This Thread
Include external library - by El Forum - 02-27-2012, 01:17 PM
Include external library - by El Forum - 02-29-2012, 07:50 AM
Include external library - by El Forum - 02-29-2012, 09:53 AM
Include external library - by El Forum - 02-29-2012, 11:20 AM
Include external library - by El Forum - 02-29-2012, 11:46 AM
Include external library - by El Forum - 02-29-2012, 12:04 PM
Include external library - by El Forum - 02-29-2012, 12:11 PM
Include external library - by El Forum - 02-29-2012, 01:29 PM
Include external library - by El Forum - 03-01-2012, 02:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB