17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1306 Views |
-
CMS Requirements

15 July 2007 at 2:39pm Last edited: 15 July 2007 2:43pm
Hi,
we are developing pluggable modules for SS and do not want to change Requirements in CMSMain::init() everytime when the new module is installed. So I have made a (maybe not optimal) solution:[code php]
class Config {// put CMS Requirements here
static function CMSRequirements() {
}static final function AllCMSRequirements() {
foreach (ClassInfo::subclassesFor(__CLASS__) as $class) {
eval("$class::CMSRequirements();");
}
}}
In the CMSMain::init() is only:
[code php]
Config::AllCMSRequirements()Each module just subclasses the Config class and fills its Requirements to the CMSRequirements method.
I know, that this is not optimal, but it has the advantage, that this code is run only when is needed, i.e. when somebody works with CMS, and not when somebody just view the pages.
-
Re: CMS Requirements

16 July 2007 at 8:55pm
Creating an entire new class for this seems like overkill...
What about something like this in _config.php
CMSMain::add_requirements(array(
'module/javascript/something.js',
'other/javascript/another.js',
)); -
Re: CMS Requirements

17 July 2007 at 9:24am
Yeah, the new class is overkill. Your idea seems better.
| 1306 Views | ||
|
Page:
1
|
Go to Top |


