Directory independent extensions

You are viewing revision #3 of this wiki article.
This version may not be up to date with the latest version.
You may want to view the differences to the latest version.

next (#4) »

How to implement directory independent extensions ΒΆ

Many people want to use downloaded extensions in their own way. As for me the most of the extensions are require me to correct Yii::import() inside their source code. All these extensions are directory dependent. To avoid a situation described I suggest to implement pseudo-anonymous aliases:

// take the current extension path
$dir = dirname(__FILE__);
// generate alias name
$alias = md5($dir);
// create alias
// import another classes
//if you want, you can destroy an alias created

Using this technique you can create a really directory-independent extension.

16 1
Viewed: 14 480 times
Version: Unknown (update)
Category: Tips
Written by: GOsha
Last updated by: GOsha
Created on: Nov 19, 2010
Last updated: 9 years ago
Update Article


View all history

Related Articles