i’m newbie here and love Yii so much as i come from wonderful framework CI too.
i try to make structure of modules system here with some idea :
1 - system have at first stage (admin - user -news ) modules
2 - "admin" have nested modules (srabc or rights - translate - module management)
the idea is to make it able to upload any modules or nested modules without modified the config/main.php, and on same time just admin who can see those modules and nested modules to add roles to it, so admin can install/uninstall or activate/deactivate, on other hand if user try to open the link to that modules and the admin didnt yet install or activate the module will throw 404 error.
i try to make it at adminModule but if i try to use $this->setModules() , it seems that it add the nested modules inside admin and there is no levels here and it cant got the upper modules too.
i try to make it as component helper to request as yii->app()->setModules(). it work just if make hack to it with
Yii::setPathOfAlias($item->getFilename(), $modulePath . DIRECTORY_SEPARATOR . $item->getFilename());
Yii::app()->setModules(array($item->getFilename() => array(‘class’ => $xparent . $item->getFilename() . ‘.’ . ucfirst($item->getFilename()) . ‘Module’)));
inside loop of DirectoryIterator result.
but i failed many and may times
any help will be appreciate here
and sorry for English if its now clear enough please ask and i will try to explain again.
Aside of answering the question HOW to do this, I’m would rather ask, if you’re sure WHAT you would like to do this?
Each module is in fact a separate yii application (sharing configuration etc.). The problem is not in modifying or not main application config (if any way of having dynamic modules is possible), but the problem is that you’re saying about uploading files of a particular module. To do this, you would have to throw away .htaccess file, which secures protected folder (without it, your webbrowser won’t see this folder and modules subfolder, so it’ll fail on upload). And doing this is a high volition of basic security rules.
Not mentioning, that modules are also combined into main application, so it is not just a file upload and configuration change. Most of them has some dependencies to main application, about which you have to take care of.
That’s why I asked, if you’re sure, what you want to do?
I have a basic application, that I use for every new project. And depending on it’s area I just copy and enable particular modules I’ll be using. But I’m doing this manually and would never think about making this in any way automatic, by letting user to upload anything to protected folder. It’s name should be self-explanatory.
thank you for answer me.
sorry for say that but it seem that my idea not clear and i didnt explain well here .
i didnt say i will upload the modules from inside the script panel. i ask about normal upload it from ftp as usual .
lets imagine that : am the developer who make Enterprise script which full encoded, and now the client who take the script have option to make modules to his script. so now he need to make the module depend on guide told him something as what to extends and what lang format , etc …
so now he need to add the moduleID into the config to make it work at first, and if that module is nested module he will need also to add to set module in parentModule.php
but as i say the both files was encoded.
so he will not be able to make it work. so i need from first to design the work flow of that and make it possible.
are now it clear enough to you ?
Now I got your idea. Sorry, to say that, but I won’t be able to help you as I don’t know this regions of Yii.
For me a module is a solid element of an application and I were never looking for any solution for making them dynamic.
thank you for try helping .
i still trying to found any methods between here and google …