views:

88

answers:

1

I just want to use a few classes Zend offers, Zend Date, Zend Mail, and a few others, but I can't get the date one to even do anything. I've included it this way:

include_once '../classes/zend/library/zend/date/DateObject.php'; $date = new Zend_Date(time());

Here's the error: Fatal error: Class 'Zend_Date' not found

Do I have to go through the steps to change the configuration files for apache, and php just to use this one class?

Any help is appreciated. Thanks.

+2  A: 

You need Zend/Date.php, not Zend/Date/DateObject.php. Furthermore, you might need some autoloader to load other classes that Zend_Date depends on, but probably not, as they are usually automatically included in the Zend class files already.

Let me correct my last statement. As a minumum you need to include the path to the Zend library in your include paths. For instance, like so:

// first entry are the already defined include paths,
// second entry is path to Zend library
set_include_path(
 get_include_path() . PATH_SEPARATOR .
 'path/to/library'
);

So, take for example the path C:\library\Zend as you Zend library, you would then have to add C:\library to your include path. This way all require|include(_once) statements in Zend components look in the right include paths.

Furthermore you can then also simply include the right component like so:

require_once 'Zend/Date.php';

$date = new Zend_Date();
fireeyedboy
Fireeyedboy, thank you so much!!! that worked perfectly!
Ronedog
Good to hear Ronedog. Happy coding :)
fireeyedboy