SOLVED: Implementing action extension

Hi,

I’m trying to create an action extension (to do autocompleting) for the site controller. I followed the guidelines in

http://www.yiiframework.com/doc/guide/extension.use

I’ve added the following code to return array of the actions() function of the site controller.


'autocomplete'=>'ext.autocomplete.SAutoCompleteAction',

I did put a php file called SAutoCompleteAction.php in directory extensions/autocomplete with a definition of the class SAutoCompleteAction and a run() function containing the actual action code.

I get the following message when calling localhost/app/index.php?r=site/autocomplete.

There’s absolutely no typing mistake made. What is wrong here? Any idea?

Rickert

I believe it has something to do with the YiiBase.php code. Because the controller can’t find the action at first, extensions are searched for using the actions() function.

The appropriate extension class file is imported (using a forced require - the complete path of the extension class file is supplied) and according to the debugger this proceeds without problems. Then a new extension class instance is created which triggers the autoload function. The autoload wants to load the class file again using include($className.’.php’) and here inclusion fails because the path is unknown.

It looks like a bug. Any comment?

SOLVED

These kind of things happen when you forget to add <?php tags to your code :wub: