Welcome Guest, Not a member yet? Register   Sign In
PEAR
#4

[eluser]alejandra[/eluser]
Hi,

I saw this post and I try to implement the solution describe http://codeigniter.com/wiki/PEAR_integration/

I downloaded the basic pear library and the Spreadsheet_Excel_Writer library and put then inside the pear folder as explain in the wiki but when I tested a I get an include error

My test function looks like this:


Code:
function example()
{
   $this->load->library('pearloader');
   $workbook = $this->pearloade->load('Spreadsheet_Excel_Writer','Writer');
   $workbook->send('test.xls');
        
   $worksheet->write(0, 0, 'Name');
   $worksheet->write(0, 1, 'Age');
   $worksheet->write(1, 0, 'John Smith');
   $worksheet->write(1, 1, 30);
   $worksheet->write(2, 0, 'Johann Schmidt');
   $worksheet->write(2, 1, 31);
   $worksheet->write(3, 0, 'Juan Herrera');
   $worksheet->write(3, 1, 32);
        
   // Let's send the file
   $workbook->close();
        
}


My Pearloader.php file look like this and is place inside the the libraries folder inside the application folder

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

class Pearloader{
  function load($package, $class,$options = null){
   require_once('../pear/'$package.'/'.$class.'.php');
   $classname = $package."_".$class;
   if(is_null($options)){
  return new $classname();
   }else{
  return new $classname($options);
   }
  }
}

?>


I have place an image inside the Spreadsheet_Excel_Writer folder and try to access from another file using plain html and it worked (this was to check if I was giving the wrong file path), if try echoing the same image tag using php I get file not found…

Code:
<img src="../pear/Spreadsheet_Excel_Writer/image1.jpg">  //can view image
  
   &lt;?
       echo '<img src="../pear/Spreadsheet_Excel_Writer/image1.jpg">';  //can't view image
  
   ?&gt;

Help please… :-S


Messages In This Thread
PEAR - by El Forum - 04-24-2009, 11:13 AM
PEAR - by El Forum - 04-24-2009, 12:03 PM
PEAR - by El Forum - 04-24-2009, 12:13 PM
PEAR - by El Forum - 05-20-2009, 08:20 AM
PEAR - by El Forum - 05-20-2009, 09:40 AM
PEAR - by El Forum - 05-20-2009, 09:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB