I'm currently in the beginning stages of building a large software application. Once I got started, I realized that using a framework might be more useful than trying to write a ton of functionality that someone else might have already written and written better (data access layers, validation classes, session handlers, etc) so I decided to check out zend framework.
I did the the quickstart tutorial shown here (http://framework.zend.com/docs/quickstart) and after a few hours of banging my head against the wall I got it to work. One puzzling error I ran into is that the autoloader attempted to load classes that are located in other web folders outside of the current working folder of the application.
Like the example suggested, I put the zend files in the library folder. I have other folders in my web folder on my local machine with other project files, etc.
At any rate, my quickstart application is attempting to autoload class files that are located elsewhere in my web folder, but not part of the quickstart application. There is no logic pointing to other web folders, all of the constants for file includes like APPLICATION_PATH are pointing to files specifically set to the application itself.
I don't know if this makes any sense but if anyone has used zend framework and has run into similar issues or can offeAr any insight, it would be much appreciated. Also if anyone can point me to either more zend specific message boards or other resources that would help as well.
Thanks in advance.
By the way, here is the Zend code that is causing errors. This is in Zend's Loader.php file, in the Zend_Loader class.
public static function loadClass($class, $dirs = null)
{
if (class_exists($class, false) || interface_exists($class, false)) {
return;
}
if ((null !== $dirs) && !is_string($dirs) && !is_array($dirs)) {
require_once 'Zend/Exception.php';
throw new Zend_Exception('Directory argument must be a string or an array');
}
// autodiscover the path from the class name
$file = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
if (!empty($dirs)) {
// use the autodiscovered path
$dirPath = dirname($file);
if (is_string($dirs)) {
$dirs = explode(PATH_SEPARATOR, $dirs);
}
foreach ($dirs as $key => $dir) {
if ($dir == '.') {
$dirs[$key] = $dirPath;
} else {
$dir = rtrim($dir, '\\/');
$dirs[$key] = $dir . DIRECTORY_SEPARATOR . $dirPath;
}
}
$file = basename($file);
self::loadFile($file, $dirs, true);
} else {
self::_securityCheck($file);
//ERROR OCCURS HERE
include_once $file;
//RIGHT HERE, THE $file VALUE contains a class name not in zend framework or the quickstart application, which throws an error
}
if (!class_exists($class, false) && !interface_exists($class, false)) {
require_once 'Zend/Exception.php';
throw new Zend_Exception("File \"$file\" does not exist or class \"$class\" was not found in the file");
}
}