Yii With Wurfl

Hi! I’m a newbie php programmer and I very bad speak English. So sorry in advance for my question)

I try to use WURFL (_wurfl.sourceforge.net/php_index.php) in Yii.

I saw the example here: _www.yiiframework.com/doc/guide/1.1/en/extension.integration:


Yii::import('application.vendors.*');

require_once('Zend/Search/Lucene.php');


$lucene=new Zend_Search_Lucene($pathOfIndex);

$hits=$lucene->find(strtolower($keyword));

Accordingly I put this code in my Controller before the Class:


Yii::import('application.vendors.*');

require_once('wurfl-php/WURFL/Application.php'); 

And this code in actionIndex():


$wurflConfig = new WURFL_Configuration_InMemoryConfig(); 

And after I see these errors:


include(WURFL_Configuration_InMemoryConfig.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory

Z:\home\localhost\www\framework\YiiBase.php(421):

else

421                     include($className.'.php');


 Z:\home\localhost\www\tds\protected\controllers\SiteController.php(52): spl_autoload_call("WURFL_Configuration_InMemoryConfig")

Listing of Application.php:


require_once dirname(__FILE__) . '/ClassLoader.php';

ClassLoader.php:


class WURFL_ClassLoader {

	

	const CLASS_PREFIX = "WURFL_";

	private static $classPath;

	/**

	 * Loads a Class given the class name

	 *

	 * @param string $className

	 * @return boolean success

	 */

	public static function loadClass($className) {

		if($className === null) {

			throw new WURFL_WURFLException("Unable To Load Class : " . $className);

		}

		if (substr($className, 0, 6) !== WURFL_ClassLoader::CLASS_PREFIX) {

			return false;

		}

		if (!class_exists($className, false)) {

			if (self::$classPath === null) self::$classPath = dirname(__FILE__) . DIRECTORY_SEPARATOR;

			$classFilePath = str_replace('_', DIRECTORY_SEPARATOR, substr($className, 6)) . '.php';

			include self::$classPath.$classFilePath;

		}

		return false;

	}

}


// register class loader

spl_autoload_register(array('WURFL_ClassLoader', 'loadClass'));

can you try to replace this code

require_once(‘wurfl-php/WURFL/Application.php’);

with

require_once(Yii::app()->request->baseUrl.’/wurfl-php/WURFL/Application.php’);

I solved the problem this way:

in ClassLoader.php changed string


spl_autoload_register(array('WURFL_ClassLoader', 'loadClass'));

to


spl_autoload_register(array('WURFL_ClassLoader', 'loadClass'), $throw=false, $prepend=true);