2

I want to be able to use SimplePie on Yii.

I'm using the 1.3-dev version of simplepie I created a "vendors" folder, put all I had in the .tar.gz in a simplepie subfolder. Then i add this lines at the beginning of my controller

Yii::import('application.vendors.SimplePie.*');
require_once 'SimplePieAutoloader.php';
spl_autoload_unregister(array('YiiBase','autoload'));
spl_autoload_register(array('SimplePie_Autoloader','autoload'));
spl_autoload_register(array('YiiBase','autoload'));

But when I try to use it, I get this error:

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

C:\wamp\www\yii\fr\framework\YiiBase.php(418)

Any ideas why I get this error?

edit: i took the compiled version of simplepie and everything works like a charm

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Polux
  • 21
  • 1
  • 3

2 Answers2

0

I think (not looked into it fully) that the Simple Pie library follows PSR-0 for class and file names. In which case you should be able to register its path and Yii's autoloader will know how to autoload it. Try adding the following to config.php;

Yii::setPathOfAlias('SimplePie', '/path/to/vendor/');

The second argument needs to point to the root folder of the library e.g. if your path is like this /var/lib/yiiproject/vendor/simplepie/lib/SimplePie then the register the path /var/lib/yiiproject/vendor/simplepie/lib

Kevin
  • 1,113
  • 3
  • 12
  • 26
0

This yii widget use SimplePie http://www.yiiframework.com/extension/yii-feed-widget/

Janka
  • 1,908
  • 5
  • 20
  • 41