I have updated mine and it now works. Here is what I had to do:
Downloaded the PEAR libraries
PEAR (core)
OLE
Spreadsheet_Excel_Writer
The vendors directory (the top level vendors directory) looks like
this:
/vendors
/css
/js
/Pear <--- Look at this, case sensitive based on those paths
above
/OLE
/OS
/PEAR
/scripts
/Spreadsheet
INSTALL
LICENSE
OLE.php
package.dtd
PEAR.php
PEAR5.php
README
System.php
template.spec
/shells
I had to update the paths on some of the PEAR libraries to include the
GLOBAL PEAR path:
/vendors/Pear/Spreadsheet/Excel/Writer.php
/vendors/Pear/Spreadsheet/Excel/Writer/Workbook.php
/vendors/Pear/OLE/PPS.php
example: require_once PEAR . 'Spreadsheet/Excel/Writer/Workbook.php';
Then include it in the controller as:
App::import('vendor', 'Spreadsheet_Excel_Writer', array('file' => '../
vendors/Pear/Spreadsheet/Excel/Writer.php'));
(That is before the class start)
Then just instantiate it like:
$xlsBook = new Spreadsheet_Excel_Writer();
where the Spreadsheet_Excel_Writer() is the same name you declared in
the import statement. (Again, thanks brian).
Now, just do the writer as you normally would. I did a blog post about
it that is more detailed, at http://www.hirdweb.com/2009/05/04/pear-and-cakephp/
(if that is appropriate to post here).
On May 4, 4:42 am, foldiman <[email protected]> wrote:
> Does anyone have a live example of Spreadsheet_Excel_Writer? Thanks.
>
> On May 3, 2:38 pm, shird <[email protected]> wrote:
>
> > Thank you. I found the problem I was having when I first replied to
> > this. I am now set on this. I did have to declare the vendors path
> > though, I am keeping my vendors in the app directory, instead of a
> > level above, so I had to change that one. After that, it works like a
> > charm.
>
> > On May 3, 9:32 am, brian <[email protected]> wrote:
>
> > > You didn't provide the correct class name. Try it this way:
>
> > > App::import('vendor', 'Spreadsheet_Excel_Writer', array('file' =>
> > > 'vendors/PEAR/
> > > Spreadsheet_Excel_Writer-0.9.1/Writer/Writer.php'));
>
> > > On Sun, May 3, 2009 at 12:17 PM, shird <[email protected]> wrote:
>
> > > > I am trying to get the Spreadsheet_Excel_Writer to work as a vendor in
> > > > CakePHP 1.2. I have downloaded the PEAR library and the
> > > > Spreadsheet_Excel_Writer libraries to the following:
>
> > > > app/vendors/PEAR/PEAR
> > > > app/vendors/PEAR/Spreadsheet_Excel_Writer-0.9.1
>
> > > > I am trying to export a list of registrations that is stored in a
> > > > MySQL database. In my controller, I am trying to load the vendor
> > > > libraries with the following:
> > > > App::import('vendor', 'xls', array('file' => 'vendors/PEAR/
> > > > Spreadsheet_Excel_Writer-0.9.1/Writer/Writer.php'));
>
> > > > I am trying to do everything from the controller and not the view, as
> > > > I want this to be a "view-less" action.
>
> > > > The code I am trying to load is as follows:
> > > > $xls = new Spreadsheet_Excel_Writer("registrations.xls");
>
> > > > and it fails and gives this error message:
> > > > Fatal error: Class 'Spreadsheet_Excel_Writer' not found in ~app/
> > > > controllers/conferences_controller.php on line 827
>
> > > > I have looked thru this group to see if there is any info or
> > > > instructions on how to include PEAR libraries with a CakePHP 1.2 app,
> > > > and I have looked thru the cookbook and there is no section for
> > > > vendors, and I have done Google searches for the info on how to do
> > > > this.
>
> > > > If anyone can steer me in the right direction, or to a site that has
> > > > the information on how to get a PEAR library to work with CakePHP 1.2,
> > > > it would be very helpful.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---